asp.net - Aps.Net Nested UpdatePanel's Button Click Event does not fire -


i have dynamically created updatepanel inside tabcontainers tabpanel. have created button inside newly created updatepanel. problems is, click event new button not fired. here example .aspx , .cs

<%@ page language="c#" autoeventwireup="true" codebehind="nestedupdatepanels.aspx.cs"     inherits="arminteststranica.nestedupdatepanels" %>  <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> <!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> </head> <body>     <form id="form1" runat="server">     <asp:toolkitscriptmanager id="toolkitscriptmanager1" runat="server">     </asp:toolkitscriptmanager>     design time created controls     <div>         <asp:updatepanel id="updatepanel1" runat="server" childrenastriggers="false" updatemode="conditional">             <contenttemplate>                 <asp:button id="btn1" runat="server" text="des btn1" onclick="btn1_click" />                 <asp:textbox id="txt1" runat="server" width="300px"></asp:textbox>                 <asp:tabcontainer id="tabcontainer1" runat="server">                     <asp:tabpanel id="tab1" runat="server" headertext="tab 1">                         <contenttemplate>                             <asp:updatepanel id="updatepanel2" runat="server" updatemode="conditional">                                 <contenttemplate>                                     <asp:button id="btn2" runat="server" text="des btn2" onclick="btn2_click" />                                     <asp:textbox id="txt2" runat="server" width="300px"></asp:textbox>                                 </contenttemplate>                                 <triggers>                                     <asp:asyncpostbacktrigger controlid="btn2" eventname="click" />                                 </triggers>                             </asp:updatepanel>                         </contenttemplate>                     </asp:tabpanel>                     <asp:tabpanel id="tabpanel2" runat="server" headertext="tab 2">                         <contenttemplate>                             <asp:updatepanel id="updatepanel3" runat="server" updatemode="conditional">                                 <contenttemplate>                                     <asp:button id="btn3" runat="server" text="des btn3" onclick="btn3_click" />                                     <asp:textbox id="txt3" runat="server" width="300px"></asp:textbox>                                 </contenttemplate>                                 <triggers>                                     <asp:asyncpostbacktrigger controlid="btn3" eventname="click" />                                 </triggers>                             </asp:updatepanel>                         </contenttemplate>                     </asp:tabpanel>                 </asp:tabcontainer>             </contenttemplate>             <triggers>                 <asp:asyncpostbacktrigger controlid="btn1" eventname="click" />             </triggers>         </asp:updatepanel>     </div>     <br />     <br />     runtime designed controls     <div>         <asp:updatepanel id="updatepanel4" runat="server" childrenastriggers="false" updatemode="conditional">             <contenttemplate>                 <asp:button id="rbtn1" runat="server" text="run btn1" onclick="rbtn1_click" />                 <asp:textbox id="rtxt1" runat="server" width="300px"></asp:textbox>                 <asp:tabcontainer id="tabcontainer2" runat="server">                 </asp:tabcontainer>             </contenttemplate>             <triggers>                 <asp:asyncpostbacktrigger controlid="rbtn1" eventname="click" />             </triggers>         </asp:updatepanel>     </div>     </form> </body> </html>  using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using ajaxcontroltoolkit;  namespace arminteststranica {     public partial class nestedupdatepanels : system.web.ui.page     {         protected void page_load(object sender, eventargs e)         {          }          protected void btn1_click(object sender, eventargs e)         {             txt1.text = "you have clicked at: " + datetime.now.tostring("dd/mm/yyyy hh:mm:ss tt");          }         protected void btn2_click(object sender, eventargs e)         {             txt2.text = "you have clicked at: " + datetime.now.tostring("dd/mm/yyyy hh:mm:ss tt");          }         protected void btn3_click(object sender, eventargs e)         {             txt3.text = "you have clicked at: " + datetime.now.tostring("dd/mm/yyyy hh:mm:ss tt");          }         protected void rbtn1_click(object sender, eventargs e)         {             rtxt1.text = "you have clicked at: " + datetime.now.tostring("dd/mm/yyyy hh:mm:ss tt");             tabcontainer2.tabs.clear();             tabpanel firstnewtabpanel = new tabpanel();             firstnewtabpanel.id = "runfirsttabpanel";             firstnewtabpanel.headertext = "run tab 1";             updatepanel firstnewupdatepanel = new updatepanel();             firstnewupdatepanel.id = "runfirstupdatepanel";             firstnewupdatepanel.updatemode = updatepanelupdatemode.conditional;             button firstnewbutton = new button();             firstnewbutton.id = "runfirstbutton";             firstnewbutton.clientidmode = clientidmode.static;             firstnewbutton.text = "run btn 2";             firstnewbutton.click += new eventhandler(firstnewbutton_click);             firstnewupdatepanel.contenttemplatecontainer.controls.add(firstnewbutton);             asyncpostbacktrigger firstnewtrigger = new asyncpostbacktrigger();             firstnewtrigger.controlid = "runfirstbutton";             firstnewtrigger.eventname = "click";             firstnewupdatepanel.triggers.add(firstnewtrigger);             firstnewtabpanel.controls.add(firstnewupdatepanel);             tabcontainer2.tabs.add(firstnewtabpanel);             tabcontainer2.activetabindex = 0;         }          void firstnewbutton_click(object sender, eventargs e)         {             rtxt1.text = "you have clicked @ runtime button 2: " + datetime.now.tostring("dd/mm/yyyy hh:mm:ss tt");         }     } } 

may change childrenastriggers="true" rendermode="block" sentences.

please go through below link

this link you


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -