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 241719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:46:37+00:00 2026-05-11T20:46:37+00:00

I have an ASP.NET page with 10 dynamically generated LinkButton elements. When a user

  • 0

I have an ASP.NET page with 10 dynamically generated LinkButton elements. When a user clicks one of these LinkButton elements, I want to display its Text in a modal dialog. The user can then change the Text by entering a value into a TextBox. My code for this looks like the following:

<asp:ScriptManager ID="theScriptManager" runat="server" />
<asp:UpdatePanel ID="myUpdatePanel" runat="server">
    <ContentTemplate>
        <asp:Table ID="myTable" runat="server" OnInit="myTable_Init" CellPadding="10" CellSpacing="10" />
    </ContentTemplate>
</asp:UpdatePanel>

<asp:LinkButton ID="testLinkButton" runat="server" />
<cc1:ModalPopupExtender ID="myPopupExtender" runat="server" TargetControlID="testLinkButton"
    OkControlID="okButton" PopupControlID="myPanel" />

<asp:Panel ID="myPanel" runat="server" Style="display: none;">
    <table border="1" cellpadding="0" cellspacing="0"><tr><td>
        <table border="0" cellpadding="0" cellspacing="0" style="width: 300px;">
            <tr><td colspan="2" style="background-color: Blue; font-weight: bold; color: White;">
                &nbsp;Test
            </td></tr>
            <tr>
                <td>You clicked <asp:TextBox ID="numTextBox" runat="server" MaxLength="3" />.</td>
                <td align="right" style="padding-top: 5px; padding-bottom: 5px;">
                    <asp:Button ID="okButton" runat="server" Text="OK" OnClick="okButton_Click" />&nbsp;
                </td>
            </tr>
        </table>
    </td></tr></table>
</asp:Panel>

My code-behind for this ASP.NET code looks like the following:

private LinkButton selectedLinkButton = null;

protected void Page_Load(object sender, EventArgs e)
{}

protected void myTable_Init(object sender, EventArgs e)
{
        TableRow row = new TableRow();
        for (int i = 1; i < 11; i++)
        {
            LinkButton linkButton = new LinkButton();
            linkButton.Text = i.ToString();
            linkButton.Click += new EventHandler(linkButton_Click);
            linkButton.CommandArgument = i.ToString();

            AddLinkButtonToRow(linkButton, row);
        }
        myTable.Rows.Add(row);

}

protected void linkButton_Click(object sender, EventArgs e)
{
    selectedLinkButton = (LinkButton)(sender);
    numTextBox.Text = selectedLinkButton.CommandArgument;

    myPopupExtender.Show();
}

protected void okButton_Click(object sender, EventArgs e)
{
    if (selectedLinkButton != null)
    {
        selectedLinkButton.Text = numTextBox.Text.Trim();
    }
}

private void AddLinkButtonToRow(LinkButton linkButton, TableRow row)
{
    TableCell cell = new TableCell();
    cell.Controls.Add(linkButton);
    row.Cells.Add(cell);
}

My problem is, I want to reduce the number of Postbacks. To accomplish this, I decided to use the ASP.NET AJAX toolkit. Unfortunately, I am not having any success with updating the LinkButton Text once a user clicks “OK” in the dialog. In addition, I seem to still be getting postbacks. How am I using this incorrectly?

Thank you,

  • 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-11T20:46:37+00:00Added an answer on May 11, 2026 at 8:46 pm

    By default, the UpdatePanel will only trigger refreshes when objects within it have their various events fired.

    You need to either move your ModalPopupExtender and code within the UpdatePanel, or assign a Update Trigger that is attached to your Ok button within your modal popup.

    If you’re still not getting a proper refresh, you may need to add a myUpdatePanel.Update() command to your Ok button code to refresh the panel after you’ve provided the content for your new LinkButton.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 214k
  • Answers 214k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I just found this: http://www.vcskicks.com/image-distortion.html It works great May 12, 2026 at 10:43 pm
  • Editorial Team
    Editorial Team added an answer Since persistent modifications to the system is either in the… May 12, 2026 at 10:43 pm
  • Editorial Team
    Editorial Team added an answer I am not sure there is a way except by… May 12, 2026 at 10:43 pm

Related Questions

I have an asp.net page with a button. This button generates and inserts a
I have an ASP.NET page that is interacting with a business class. I want
I have an html table which i bind data dynamically on the server side
In one of my projects I need to build an ASP.NET page and some

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.