asp.net button/linkbutton webcontrol dynamically added in bootstrap modal body doesn't postback asp.net button/linkbutton webcontrol dynamically added in bootstrap modal body doesn't postback asp.net asp.net

asp.net button/linkbutton webcontrol dynamically added in bootstrap modal body doesn't postback


First make sure that your custom webcontrol inside Updatepanel still exist at the end of page life cycle. I assume you are calling a function where you are adding linkbutton to the webcontrol. something like this:

// Custom function Creating link buttonsprivate void CreateControls() {// Create your link buttons here.}

Now try calling the same function again inside page pre-init method which ensures that the control still exist at the time of button click event. something like this:

//Page Pre Initprotected void Page_PreInit(object sender, EventArgs e){CreateControls();}

Make sure you have your web control added to updatepanel inside the same function as listed above. Here is a sample code attaching webcontrol to the updatepanel.

yourUpdatePanel.ContentTemplateContainer.Controls.Add(wc_tdSelect);

I am sure you will have your desired result this time :)


I have run into similar issue with modal pop-ups and the problem is basically (as stated similarly above), is the sequence of when the asp.net control is rendered verses when events and/or JS functions get registered.

One way to solve is to render an HTML control manually so that you can control it's name and when it gets rendered.


Generally you should be avoiding the dynamic controls, you should add button in design time inside div and show/hide that div on client side for popup.

Have a look at this thread:-

stackoverflow