Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7602937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:32:26+00:00 2026-05-30T23:32:26+00:00

I have an ASP.NET Web Forms application. In my GridView OverviewGridView there is a

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:32:27+00:00Added an answer on May 30, 2026 at 11:32 pm

    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

    upatePanel1.Update();
    
    1. Check this link for another example

    Edit Check Fully working example. You have to manually update the modal popup updatepanel to see any changes to textbox.
    ASPX

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <link rel="Stylesheet" type="text/css" href="css/StyleSheet.css" />
        <style type="text/css">
            .modal
            {
                background-color: Aqua;
                width: 150px;
                height: 100px;
                padding: 6px;
            }
            .modalBackground
            {
                background-color: #CCCCFF;
                filter: alpha(opacity=40);
                opacity: 0.5;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:UpdatePanel ID="upnGrid" runat="server">
                <ContentTemplate>
                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                    <asp:GridView CssClass=".Grid-blue" ID="GridView1" runat="server" AllowPaging="True"
                        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="LinqDataSource1">
                        <Columns>
                            <asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"
                                ReadOnly="True" SortExpression="ProductID" />
                            <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
                            <asp:BoundField DataField="SupplierID" HeaderText="SupplierID" SortExpression="SupplierID" />
                            <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" SortExpression="CategoryID" />
                            <asp:BoundField DataField="QuantityPerUnit" HeaderText="QuantityPerUnit" SortExpression="QuantityPerUnit" />
                            <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" />
                            <asp:BoundField DataField="UnitsInStock" HeaderText="UnitsInStock" SortExpression="UnitsInStock" />
                            <asp:BoundField DataField="UnitsOnOrder" HeaderText="UnitsOnOrder" SortExpression="UnitsOnOrder" />
                            <asp:BoundField DataField="ReorderLevel" HeaderText="ReorderLevel" SortExpression="ReorderLevel" />
                            <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued" />
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbEdit" runat="server" OnClick="lbEdit_Click">Edit</asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="DataClassesDataContext"
                EntityTypeName="" TableName="Products">
            </asp:LinqDataSource>
        </div>
        <ajaxToolkit:ModalPopupExtender BackgroundCssClass="modalBackground" ID="mpeDetails"
            CancelControlID="btnClosePopup" TargetControlID="btnShowModal" PopupControlID="pnlDetails"
            runat="server">
        </ajaxToolkit:ModalPopupExtender>
        <asp:Button ID="btnShowModal" runat="server" Text="Button" Style="display: none" />
        <asp:Panel ID="pnlDetails" CssClass="modal" runat="server" Style="display: none">
            <asp:UpdatePanel ID="upnDetails" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <label>
                        ID:</label><asp:TextBox ID="txtID" runat="server"></asp:TextBox>
                    <br />
                    <label>
                        Name:</label>
                    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                    <br />
                </ContentTemplate>
            </asp:UpdatePanel>
            <div>
                <asp:Button ID="btnClosePopup" runat="server" Text="Cancel" /></div>
        </asp:Panel>
        </form>
    </body>
    </html>
    

    .CS

       protected void lbEdit_Click(object sender, EventArgs e)
    {
        LinkButton lbTemp = (LinkButton)sender;
    
        if (lbTemp != null)
        {
            GridViewRow grow =(GridViewRow) lbTemp.NamingContainer;
            int id = Convert.ToInt32(GridView1.DataKeys[grow.RowIndex][0].ToString());
            mpeDetails.Show();
            txtID.Text = id.ToString();
            upnDetails.Update();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET web application that is using forms authentication. Everything is configured
I have a ASP.NET Web Forms application that internally makes many SOAP and REST
I have an ASP.NET web forms application that requires that requires that a user
We have an ASP.NET web forms application that is probably vulnerable to Cross-site request
I have an asp.net Web Forms application that needs to send emails. I like
I have an ASP .NET Web Forms application that makes use of the 'WebMethod'
I have an ASP.NET web forms application that pulls email from an IMAP account.
I have an older ASP.NET MVC application that uses classic web forms views. As
I have an ASP.NET Web Forms application. In my application I have a GridView
I have an ASP.NET Web Forms application. There is a page with TextBoxes and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.