Long time listener, first time caller!
I have an ASXP page that has a panel. When I click a button on the master ASPX page some code is run that loads a custom ascx control into the panel. When the master page initially loads a "home" control is loaded. When a button on the master page is clicked, the home control is cleared and another control is loaded. The problem is that when I click on a link label in the custom control all of a sudden the custom control is unloaded and the home control is re-loaded.
It looks something like this (Im sorry if this is hard to read.)
Master Page - home.aspx - ASP
<html>
<body>
<table>
<tr>
<td><asp:LinkButton ID=”link1” runat=”server” OnClick=”Load_Control2” /></td>
<td><asp:Panel ID=”Panel1” runat=”server” /></td>
</tr>
</table>
</body>
</html>
Master Page - home.aspx – C#
protected void Page_Load(object sender, EventArgs e)
{
UserControl control =(PageControls.Control1)LoadControl("PathtoControl");
ApplicationDock.Controls.Add(control);
}
protected void Load_Control2(object sender, EventArgs e)
{
ApplicationDock.Controls.Clear();
UserControl control =(PageControls.Control2)LoadControl("PathtoControl");
ApplicationDock.Controls.Add(control);
}
Custom Control1 – ASCX – ASP
<div>
<table>
<tr>
<td><h2> Welcome Home </h2></td>
</tr>
</table>
</div>
Custom Control2 – ASCX – ASP
<div>
<asp:LinkButton ID=”CustomLink1” runat=”Server” Onclick=”RunClodeBlock1” />
</div>
Custom Control2 – ASCX – C#
Protected void RunClodeBlock1 (object sender, EventArgs e)
{
Response.redirect(“google.com”);
}