I know that I should post my question in the asp.net forum but I did not want just anyone to answer my question. I want just the “Pros” answers. First off; I don’t want to use master pages. I hate them! Second I want to that everyone that posts a reply to this question in advance.
I have three “user controls” and on page (see below). The steps that I am trying to do and will not give up on till I get a solution. Everything is possible; just trying to rig it to work is the test.
Walk through: The “Default.aspx” page loads and within that page there are two “PlaceHolder”s. Both are pre-populated with a link (PlaceHolder01) and text (PlaceHolder02). When the link within “PlaceHolder01” (Link One) is clicked; on the postback “PlaceHolder01” gets a new user control injected within it and the verbage for “PlaceHolder01” is now “Link Two”. All this works so far.
Here is where the problem starts:
When you click on “Link Two” within “PlaceHolder01” the postback should change the value within “PlaceHolder02” with another user control. But it does not.
Anyone knows why? Or has a work around?
Thanks,
CroCrew~
Default.aspx
-
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
-
<!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">
-
<div>
-
Links:
-
<asp:PlaceHolder runat="server" ID="PlaceHolder01">
-
<a href="#" id="btnLinkOne" runat="server">Link One</a>
-
</asp:PlaceHolder>
-
<br />
-
<br />
-
<br />
-
<br />
-
Body:
-
<asp:PlaceHolder runat="server" ID="PlaceHolder02">
-
Welcome!
-
</asp:PlaceHolder>
-
</div>
-
</form>
-
</body>
-
</html>
-
Default.aspx.vb
-
Partial Class _Default
-
Inherits System.Web.UI.Page
-
-
Protected Sub btnLinkOne_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLinkOne.ServerClick
-
btnLinkOne.Controls.Clear()
-
btnLinkOne.Controls.Add(LoadControl("WebUserControl.ascx"))
-
End Sub
-
End Class
-
WebUserControl.ascx
-
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="WebUserControl.ascx.vb" Inherits="WebUserControl" %>
-
<a href="#" id="btnLinkTwo" runat="server">Link Two</a>
-
WebUserControl.ascx.vb
-
Partial Class WebUserControl
-
Inherits System.Web.UI.UserControl
-
-
Protected Sub btnLinkTwo_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLinkTwo.ServerClick
-
Page.FindControl("PlaceHolder02").Controls.Clear()
-
Page.FindControl("PlaceHolder02").Controls.Add(LoadControl("WebUserControl2.ascx"))
-
End Sub
-
End Class
-
WebUserControl2.ascx
-
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="WebUserControl2.ascx.vb" Inherits="WebUserControl2" %>
-
<b>Cool!!</b>
-