asp.net - <asp:updatePanel> inside a user control -
i using asp:updatepanel inside user control. user control included inside '.aspx' page. registered , used follows:
<%@ register src="~/forms/testpage.ascx" tagprefix="ig" tagname="usercontrol1" %> <asp:panel id="uctestusercntrl" visible="false" runat="server"> <ig:usercontrol1 id="usercontrol1" runat="server" /> </asp:panel> <!-- user control code in diferent page '.ascx' file --> <%@ control language="c#" debug="true" codefile="testusercntrl.ascx.cs" inherits="test_webusercontrol" autoeventwireup="true" classname="testusercontrol" %> <asp:content id="content1" runat="server" contentplaceholderid="maincontent"> <asp:scriptmanager id="scriptmanager1" enablepartialrendering="true" runat="server"> </asp:scriptmanager> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:timer id="timer1" runat="server" interval="1000" ontick="time_tick"> </asp:timer> <asp:label id="lbltimedisplay" text="00:00:00" runat="server" /> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="timer" eventname="tick" /> </triggers> </asp:updatepanel> </asp:content>
the user control looks as:
with error as: "content controls have top-level controls in content page or nested master page references master page."
any suggestion on how fix error.
you have put user control in <contenttemplate></contenttemplate>
.if put outside give error get.
<%@ register src="~/forms/testpage.ascx" tagprefix="ig" tagname="usercontrol1" %> <!-- user control code in diferent page '.ascx' file --> <%@ control language="c#" debug="true" codefile="testusercntrl.ascx.cs" inherits="test_webusercontrol" autoeventwireup="true" classname="testusercontrol" %> <asp:content id="content1" runat="server" contentplaceholderid="maincontent"> <asp:scriptmanager id="scriptmanager1" enablepartialrendering="true" runat="server"> </asp:scriptmanager> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:panel id="uctestusercntrl" visible="false" runat="server"> <ig:usercontrol1 id="usercontrol1" runat="server" /> </asp:panel> <asp:timer id="timer1" runat="server" interval="1000" ontick="time_tick"> </asp:timer> <asp:label id="lbltimedisplay" text="00:00:00" runat="server" /> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="timer" eventname="tick" /> </triggers> </asp:updatepanel> </asp:content>
Comments
Post a Comment