<%@ Page Language="C#" Debug="true" %> <script runat="server"> void Page_Load(object sender, EventArgs e) { Control objCtrl; string strPage; strPage = Request.QueryString["p"]; if(strPage == "page1") { objCtrl = LoadControl("~/MyUserControl4_1.ascx"); } else if(strPage == "page2") { objCtrl = LoadControl("~/MyUserControl4_2.ascx"); } else { objCtrl = LoadControl("~/MyUserControl4_0.ascx"); } this.lblText.Controls.Add(objCtrl); } </script> <html> <head> <title>ThaiCreate.Com ASP.NET - Web User Control</title> </head> <body> <form id="form1" runat="server"> <asp:HyperLink id="hplLink1" runat="server" NavigateUrl="?p=page1">Menu(1)</asp:HyperLink> <asp:HyperLink id="hplLink2" runat="server" NavigateUrl="?p=page2">Menu(2)</asp:HyperLink> <asp:Label id="lblText" runat="server"></asp:Label> </form> </body> </html>
<script Language="C#" runat="server"> void Page_Load(object sender, EventArgs e) { this.lblText.Text = "Welcome To www.ThaiCreate.Com"; } </script> <table style="width: 550px" border="1"> <tr> <td style="height: 73px; text-align: center"> <asp:Label ID="lblText" runat="server" Font-Size="X-Large"></asp:Label></td> </tr> </table>
<script Language="C#" runat="server"> void Page_Load(object sender, EventArgs e) { this.lblText.Text = "Welcome To www.ThaiCreate.Com (1)"; } </script> <table style="width: 550px" border="1"> <tr> <td style="height: 73px; text-align: center"> <asp:Label ID="lblText" runat="server" Font-Size="X-Large"></asp:Label></td> </tr> </table>
<script Language="C#" runat="server"> void Page_Load(object sender, EventArgs e) { this.lblText.Text = "Welcome To www.ThaiCreate.Com (2)"; } </script> <table style="width: 550px" border="1"> <tr> <td style="height: 73px; text-align: center"> <asp:Label ID="lblText" runat="server" Font-Size="X-Large"></asp:Label></td> </tr> </table>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท