c# - ASP UpdatePanel doesn't work when used in ContentPage -
my code works fine when used in normal webform. when use in webform using masterpages, doesn't work.
page header : ~/manager/basemanager.master
and nested master pages : base.master > pages.master > basemanager.master
asp
<asp:scriptmanager id="scriptmanager1" runat="server"></asp:scriptmanager> <asp:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <triggers> <asp:asyncpostbacktrigger eventname="click" controlid="btnupdateeditpage" /> </triggers> <contenttemplate> <asp:label id="lbltest" runat="server" text="label"></asp:label> </contenttemplate> </asp:updatepanel> <asp:button id="btnupdateeditpage" cssclass="btnupdateeditpage" runat="server" text="button" onclick="btnupdateeditpage_click" />
c#
protected void btnupdateeditpage_click(object sender, eventargs e) { lbltest.text += "**"; }
do following please:
1- add updatepanel1.update(); following:
protected void btnupdateeditpage_click(object sender, eventargs e) { lbltest.text += "**"; updatepanel1.update(); //your updatepanel should updatemode="conditional" have now.. }
2- put button inside update panel
3- remove trigger not fire post back, code has like:
<asp:scriptmanager id="scriptmanager1" runat="server"></asp:scriptmanager> <asp:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <contenttemplate> <asp:label id="lbltest" runat="server" text="label"></asp:label> <asp:button id="btnupdateeditpage" cssclass="btnupdateeditpage" runat="server" text="button" onclick="btnupdateeditpage_click" /> </contenttemplate> </asp:updatepanel>
Comments
Post a Comment