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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:47:26+00:00 2026-06-07T05:47:26+00:00

Any help would be appreciated — here is my aspx code – <div id=div_Detail

  • 0

Any help would be appreciated —

here is my aspx code –

<div id="div_Detail" class="div_det" runat="server" />

and in my code behind –

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

private void LoadDetail() {
    HtmlTable tbl = new HtmlTable();
    HtmlTableRow row = new HtmlTableRow();
    HtmlTableCell cell = new HtmlTableCell();

    Button bUpdate = new Button();
    bUpdate.Text = "Update";
    bUpdate.Click += this.Update_Click;

    cell.Controls.Add(bUpdate);
    row.Cells.Add(cell);
    tbl.Rows.Add(row);
    div_Detail.Controls.Add(tbl);
}

private void Update_Click(object sender, EventArgs e) {
    //Do something
}

I see the button on the page with the correct text. But on clicking that button, Update_Click never gets called.

Am I missing something?

  • 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-06-07T05:47:28+00:00Added an answer on June 7, 2026 at 5:47 am

    Try giving the button an id. The .NET engine needs IDs on controls during postback to associate the control with a given event delegate.

    Edit:

    This code works fine:

     protected void Page_Load(object sender, EventArgs e) {
            LoadDetail();
        }
    
        private void LoadDetail() {
            HtmlTable tbl = new HtmlTable();
            HtmlTableRow row = new HtmlTableRow();
            HtmlTableCell cell = new HtmlTableCell();
    
            Button bUpdate = new Button();
            bUpdate.Text = "Update";
            bUpdate.Click += this.Update_Click;
            bUpdate.ID = "btnID";
    
            cell.Controls.Add(bUpdate);
            row.Cells.Add(cell);
            tbl.Rows.Add(row);
            div_Detail.Controls.Add(tbl);
        }
    
        private void Update_Click(object sender, EventArgs e) {
            //Do something 
        } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Any help would be appreciated! Here is the code in the main view, lets
Any help would be appreciated, I'm trying to convert the code below to C#,
I am stuck here, any help would be appreciated. I have a listbox of
I am relatively new to db design, so any help here would be appreciated.
Any help here would be greatly appreciated. I have this table hospital Nurse |
I'm not sure why this code isn't working, so any help would be appreciated.
Here is my failed attempt at the problem any help would be appreciated. I
Any help would be appreciated. I am looking for a way to programatically notified
I am new to jQuery. Any help would be appreciated I have two radio
I'm having trouble deserializing an array in .NET MVC3, any help would be appreciated.

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.