I have created a user control which is basically just like the include file in the old asp code.
userform.ascx looks like this
mainpage.aspx looks like this. To save space, I have just put the code that is linked to this question:Code:<%@ Control Language="c#" AutoEventWireup="false" Codebehind="userform.ascx.cs" Inherits="user.userform" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> <TR> <td><font color="red" size="bold">*</font> User Name</td> <td><asp:textbox id="userName" MaxLength="50" Runat="server"></asp:textbox></td> </TR> <TR> <td><font color="red" size="bold">*</font> Password</td> <td><asp:textbox id="password" MaxLength="50" Runat="server" TextMode="Password"></asp:textbox></td> </TR>
In the userform.ascx.cs Page_Load routine I have the following code:Code:<%@ Reference Control="userform.ascx" %> . . . . </tr> <asp:PlaceHolder id="userHolder" Runat="server"></asp:PlaceHolder> <tr> . . .
Now how can I check what the value of user name and password is from the main.aspx? Thanks in advanceCode:Control UserInfo = LoadControl("userform.ascx"); userHolder.Controls.Add(UserInfo);




Reply With Quote