Extending LoginName Control !!
-
Hi, I want to show some more information in the LoginName control instead of just the user name. For example, i may want to show the email address or full name in LoginName control. So, I wanted to extend the control and create a new one. But, I dont understand how to retrieve the value of the login name in the code, there is no property such as 'Value'. The only property is closed to the desired one is 'FormatString', but cant understand how to get the value. Can you please give me a guideline. Regards.
-
Hi, I want to show some more information in the LoginName control instead of just the user name. For example, i may want to show the email address or full name in LoginName control. So, I wanted to extend the control and create a new one. But, I dont understand how to retrieve the value of the login name in the code, there is no property such as 'Value'. The only property is closed to the desired one is 'FormatString', but cant understand how to get the value. Can you please give me a guideline. Regards.
Hello! It isn't difficult to do. You drag Login Control into your page. Click on SmartTag and then choose "Convert to Template". You should get the following html code:
<asp:Login ID="Login1" runat="server"> <LayoutTemplate> <table border="0" cellpadding="1" cellspacing="0" style="border-collapse:collapse;"> <tr> <td> <table border="0" cellpadding="0"> <tr> <td align="center" colspan="2"> Log In</td> </tr> <tr> <td align="right"> <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label> </td> <td> <asp:TextBox ID="UserName" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label> </td> <td> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
-
Hello! It isn't difficult to do. You drag Login Control into your page. Click on SmartTag and then choose "Convert to Template". You should get the following html code:
<asp:Login ID="Login1" runat="server"> <LayoutTemplate> <table border="0" cellpadding="1" cellspacing="0" style="border-collapse:collapse;"> <tr> <td> <table border="0" cellpadding="0"> <tr> <td align="center" colspan="2"> Log In</td> </tr> <tr> <td align="right"> <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label> </td> <td> <asp:TextBox ID="UserName" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label> </td> <td> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
Thanks, actually I did not mean the Login Control, rather, I meant the LoginName control. But anyway, I have solved the problem by developing a new custom control from scratch. :) Regards,