.net - Custom CreateUserWizard adding 2 fields -


i attempting customise createuserwizard following in book, when come reference them in code behind error saying 'fieldname not declared' each field i'm adding, present in page correct id's, doing wrong?

i trying add firstname , lastname field bottom of createuserwizard , remove need security question.

markup:

<asp:createuserwizard id="createuserwizard1" runat="server" oncreateduser="createuserwizard1_createduser">         <wizardsteps>             <asp:createuserwizardstep id="createuserwizardstep1" runat="server">                 <contenttemplate>                     <table>                         <tr>                             <td align="center" colspan="2">                                 sign 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>                                 <asp:requiredfieldvalidator id="usernamerequired" runat="server"                                      controltovalidate="username" errormessage="user name required."                                      tooltip="user name required." validationgroup="createuserwizard1">*</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 required."                                      tooltip="password required." validationgroup="createuserwizard1">*</asp:requiredfieldvalidator>                             </td>                         </tr>                         <tr>                             <td align="right">                                 <asp:label id="confirmpasswordlabel" runat="server"                                      associatedcontrolid="confirmpassword">confirm password:</asp:label>                             </td>                             <td>                                 <asp:textbox id="confirmpassword" runat="server" textmode="password"></asp:textbox>                                 <asp:requiredfieldvalidator id="confirmpasswordrequired" runat="server"                                      controltovalidate="confirmpassword"                                      errormessage="confirm password required."                                      tooltip="confirm password required." validationgroup="createuserwizard1">*</asp:requiredfieldvalidator>                             </td>                         </tr>                         <tr>                             <td align="right">                                 <asp:label id="emaillabel" runat="server" associatedcontrolid="email">e-mail:</asp:label>                             </td>                             <td>                                 <asp:textbox id="email" runat="server"></asp:textbox>                                 <asp:requiredfieldvalidator id="emailrequired" runat="server"                                      controltovalidate="email" errormessage="e-mail required."                                      tooltip="e-mail required." validationgroup="createuserwizard1">*</asp:requiredfieldvalidator>                             </td>                         </tr>                         <tr>                             <td align="right">                                 <asp:label id="firstnamelabel" runat="server" associatedcontrolid="firstname">first name:</asp:label>                             </td>                             <td>                                 <asp:textbox id="firstname" runat="server"></asp:textbox>                                 <asp:requiredfieldvalidator id="firstnamerequired" runat="server"                                      controltovalidate="firstname" errormessage="first name required."                                      tooltip="first name required." validationgroup="createuserwizard1">*</asp:requiredfieldvalidator>                             </td>                         </tr>                         <tr>                             <td align="right">                                 <asp:label id="lastnamelabel" runat="server" associatedcontrolid="answer">last name:</asp:label>                             </td>                             <td>                                 <asp:textbox id="lastname" runat="server"></asp:textbox>                                 <asp:requiredfieldvalidator id="lastnamelabelrequired" runat="server"                                      controltovalidate="lastname" errormessage="last name required."                                      tooltip="last name required." validationgroup="createuserwizard1">*</asp:requiredfieldvalidator>                             </td>                         </tr>                         <tr>                             <td align="center" colspan="2">                                 <asp:comparevalidator id="passwordcompare" runat="server"                                      controltocompare="password" controltovalidate="confirmpassword"                                      display="dynamic"                                      errormessage="the password , confirmation password must match."                                      validationgroup="createuserwizard1"></asp:comparevalidator>                             </td>                         </tr>                         <tr>                             <td align="center" colspan="2" style="color:red;">                                 <asp:literal id="errormessage" runat="server" enableviewstate="false"></asp:literal>                             </td>                         </tr>                     </table>                 </contenttemplate>             </asp:createuserwizardstep>             <asp:completewizardstep id="completewizardstep1" runat="server">             </asp:completewizardstep>         </wizardsteps>     </asp:createuserwizard> 

code-behind:

protected sub createuserwizard1_createduser(byval sender object, byval e system.eventargs)     dim pc profilecommon = new profilecommon()     pc.initialize(createuserwizard1.username.tostring(), true)      pc.firstname = firstname.text     pc.lastname = lastname.text      pc.save() end sub 

they wont accessable directly that. use code values.

var fn = createuserwizardstep1.contenttemplatecontainer.findcontrol("firstname"); var ln = createuserwizardstep1.contenttemplatecontainer.findcontrol("lastname"); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -