0

When using asp:login, asp:forgotpassword and asp:createuserwizard controls within an ascx. (e.g registration.ascx) it can't find e.g UserName, even though it exists within LayoutTemplate. Any idea how to fix this?

1 Answer 1

3

If you open smart tag for control in design mode,you shall see that there are steps that can be convertible to templates for customization.

CreateUserWizard http://img197.imageshack.us/img197/3823/7d4df5a594a1abdb8fdc8f1.png

For CreateUserWizard , press Customize Create User Step and you will observe that,control is converted into a table template which you can see how controls named i.e. UserName,Password...

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
        <WizardSteps>
            <asp:CreateUserWizardStep runat="server" ID="CreateUserWizardStep1">
                <ContentTemplate>
                    <table border="0">
                        <tr>
                            <td align="center" colspan="2">
                                Sign Up for Your New Account</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>

.......

Also know that If you wish to find control from inner templates , you must look for templates with FindControl method to reach the control you desire. To Find UserName Control in above code,use

CreateUserWizardStep1.TemplateControl.FindControl("UserName") as TextBox

Hope this helps to solve your problem

Sign up to request clarification or add additional context in comments.

1 Comment

When using <asp:Login> inside the masterpage, I get no error. When inserting the <asp:login> inside a usercontrol inside an login.ascx, I get this: UserLogin: LayoutTemplate does not contain an IEditableTextControl with ID UserName for the username.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.