How To Reference Custom Textboxes In CreateUserWizard TemplateWizardSteps

Last post 09-15-2006 1:00 PM by codequest. 2 replies.

Sort Posts:

  • How To Reference Custom Textboxes In CreateUserWizard TemplateWizardSteps

    09-14-2006, 7:58 PM
    • Contributor
      2,127 point Contributor
    • codequest
    • Member since 10-30-2005, 2:55 PM
    • Posts 461

    I've customized a CreateUserWizard, part of which is shown below.
    On the "CreatedUser" event, I'm going to write some of these fields to another file (other than the ASPNETDB files)
    However, I can't seem to reference the textboxes.

    me.createuserwizard1 doesn't show them in intellisense...
    me.UserFirstName doesn't hit that one...
    adding UserFirstName to profile/names in web.config doesn't help...

    Any suggestion?  I hope I don't have to use FindControls, etc...it seems there should be some support for this...but whatever it takes :-)

    Thanks!

    <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" Height="188px">

    <WizardSteps>

    <asp:TemplatedWizardStep ID="AddNameInfo" runat="server" Title="Add Name Information">

    <ContentTemplate>

    <table border="0">

    <tr>

    <td align="center" colspan="2" style="height: 24px; text-align: center">

    <strong>Add Name Information</strong></td>

    </tr>

    <tr>

    <td align="right" class="CreateUserTitleCell" style="width: 135px; height: 20px">

    <asp:Label ID="UserFirstNameLabel" runat="server" AssociatedControlID="UserFirstName">User First Name:</asp:Label></td>

    <td class="CreateUserDataCell" style="width: 257px; height: 20px;">

    <asp:TextBox ID="UserFirstName" runat="server" Width="220px"></asp:TextBox>

    <span style="color: red">*</span>&nbsp;

    </td>

    </tr>

    <tr>

    <td align="right" class="CreateUserTitleCell" style="width: 135px">

    <asp:Label ID="UserMiddleInitialLabel" runat="server" Text="User Middle Initial"></asp:Label></td>

    <td class="CreateUserDataCell" style="width: 257px">

    <asp:TextBox ID="UserMiddleInitialTextBox" runat="server" Width="32px"></asp:TextBox><span

    style="color: red"></span></td>

    </tr>

    <tr>

    <td align="right" class="CreateUserTitleCell" style="width: 135px">

    <asp:Label ID="UserLastNameLabel" runat="server" AssociatedControlID="UserLastName">User Last Name:</asp:Label></td>

    <td class="CreateUserDataCell" style="width: 257px">

    <asp:TextBox ID="UserLastName" runat="server" Width="220px"></asp:TextBox>

    <span style="color: red">*</span>&nbsp;

    </td>

    etc

  • Re: How To Reference Custom Textboxes In CreateUserWizard TemplateWizardSteps

    09-15-2006, 3:17 AM

    In general,you can't access any control directly by id when it's loacted in a template

    you have to use FindControl (even more ugly):

    AddNameIfo.ContentTemplateContainer.FindControl("UserFirstName")

    have a look @ http://aspnet.4guysfromrolla.com/articles/062806-1.aspx

  • Re: How To Reference Custom Textboxes In CreateUserWizard TemplateWizardSteps

    09-15-2006, 1:00 PM
    Answer
    • Contributor
      2,127 point Contributor
    • codequest
    • Member since 10-30-2005, 2:55 PM
    • Posts 461

    Thanks a lot.  I like that answer because if the 4-Guys can't do it better, I'm confident it can't be done better.

    My take away from all this is that before someone invests in customizing the CreateUserWizard, they ought to review whether it will be easier and faster to do their own input collection forms and then use membership.createuser method.

    This is a great answer because it's clear in my case

    a) I don't need the automagic of the wizard
    b) I understand how to use the membership.createmember method  http://msdn2.microsoft.com/en-us/library/82xx2e62.aspx
    c) my registration field collection customization is fairly extensive

    Yay, I like no-brainer, don't look back decisions!

    Grazie, big help!

Page 1 of 1 (3 items)
Microsoft Communities