I have an ASP.NET Web Forms application. In my GridView OverviewGridView there is a button dlButton that onclick triggers a ModalPopupExtender DisplayLinkMPE that controls a Panel dlModalPanel. Upon dlButton click I want to display some text (that differs depending on the GridView’s row) when the dlModalPanel pops up. I have this code in my aspx:
<asp:Button ID="dlButton" runat="server" CommandName="DisplayLink" CommandArgument="<%# TryCast(Container,GridViewRow).RowIndex %>" Text="Copy Link" />
<ajax:ModalPopupExtender ID="DisplayLinkMPE" runat="server" TargetControlID="dlButton" PopupControlID="dlModalPanel" CancelControlID="btnCancel" BackgroundCssClass="modalBackground" />
<asp:ScriptManager ID="ModalDialogScriptManager" runat="server" />
<asp:Panel ID="dlModalPanel" runat="server" Style="display: none;">
<table>
<tr align="center">
<td colspan="2">
<asp:Label ID="lblDownloadLink" runat="server" ForeColor="White">Copy Download Link:</asp:Label>
<asp:Label ID="txtDownloadLink" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
In my code behind the dlButton click is handled by the OverviewGridView RowCommand event handler, which is executed after the Page is postback:
Dim selectedRowIndex As Integer = Convert.ToInt32(e.CommandArgument)
Dim displayLinkMPE As AjaxControlToolkit.ModalPopupExtender = OverviewGridView.Rows(selectedRowIndex).FindControl("displayLinkMPE")
//Get itemUrl
txtDownloadLink.Text = itemUrl
displayLinkMPE.Show()
Everything is displayed correctly but the Text in txtDownloadLink remains empty. How can I update this Text? Thanks
I understand also C# so answers in both languages are welcome!
Check this excellent post by Matt Berseth Check it here, I think you must use an updatepanel & wrap your modal code inside it, then manually update the UpdatePanel with
Edit Check Fully working example. You have to manually update the modal popup updatepanel to see any changes to textbox.
ASPX
.CS