Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am implementing general layout using asp.net. This application uses single ASPX with dynamically loaded ASCX's:

<div class="page-all">
		<div id="page-left" class="page-left">
			<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
				<ContentTemplate>
					<div runat="server">
					</div>
				</ContentTemplate>
			</asp:UpdatePanel>
		</div>
		<div id="page-middle" class="page-middle">
			<asp:UpdatePanel ID="upContent" runat="server" UpdateMode="Conditional">
				<ContentTemplate>
					<div runat="server">
					</div>
				</ContentTemplate>
			</asp:UpdatePanel>
		</div>
		<div id="page-right" class="page-right">
			<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
				<ContentTemplate>
					<div runat="server">
					</div>
				</ContentTemplate>
			</asp:UpdatePanel>
		</div>
	</div>


In those inner divs I am loading ASCX using:
divContentPlaceholder.Controls.Add(LoadControl("~/Modules/Contents/test.ascx"));
upContent.Update();


One of those ASCX contains <asp:Button>. After clicking this button the hosting divs gets empty (ASCX is unloaded). Why i that? It does not even enter onclick handler in codebehind.

Thank you in advance for help
Posted
Updated 3-Jun-13 7:14am
v2

1 solution

Use CreateChildControl.
Or unload and reload the control on every postback....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900