Try including CausesValidation='false'
to your LinkButton.
Linkbutton inside update panel doesnot enable from code behind
-
07-10-2022 - |
Question
In a usercontrol I have an update panel which contains a AjaxFileUpload control and a link button to view the file being uploaded by the AjaxFileUpload control. Ascx page is:
<asp:UpdatePanel runat="server" ID="UpdatePanelUpload" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel runat="server" ID="pnlUploadFile">
<div class="button-action-row">
<h2>
<asp:Label ID="lblUploadHeader" runat="server" Text="Upload File"></asp:Label>
</h2>
</div>
<div class="button-action-row">
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" ContextKeys="one" OnUploadComplete="UploadComplete" />
<span class="right">
<asp:LinkButton ID="lnkBtnViewUploadDoc" runat="server" Text="View Supplier Contract"
OnClick="lnkBtnViewUploadDoc_Click"></asp:LinkButton></span>
</div>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="lnkBtnViewUploadDoc" />
</Triggers>
</asp:UpdatePanel>
This usercontrol is loaded in a modal popup.While usercontrol is loaded it checked if file is available in the location, if not the lnkBtnViewUploadDoc is disabled, which works fine. On UploadComplete event, I made lnkBtnViewUploadDoc enabled. But this is not happening. I also tried moving lnkBtnViewUploadDoc to a different panel and updated that updatepanel on UploadComplete event of AjaxFileUpload1. Where am i getting wrong here.
No correct solution
OTHER TIPS
Can you try with AsyncPostBackTrigger
<asp:AsyncPostBackTrigger ControlID="lnkBtnViewUploadDoc" EventName="Event name"></asp:AsyncPostBackTrigger>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow