Click here to Skip to main content
15,914,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to edit the register form asp.net for aspnetdb table and add security question, address and mobile number to the following code?



C#
<asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="false" 
        OnCreatedUser="RegisterUser_CreatedUser" ForeColor="White">
        <LayoutTemplate>
            <asp:PlaceHolder ID="wizardStepPlaceholder" runat="server"></asp:PlaceHolder>
            <asp:PlaceHolder ID="navigationPlaceholder" runat="server"></asp:PlaceHolder>
        </LayoutTemplate>
        <WizardSteps>
            <asp:CreateUserWizardStep ID="RegisterUserWizardStep" runat="server">
                <ContentTemplate>
                    <h1 class="pagetitle">
               Create a New Account
        </h1>
                       <br />
                    <p style="color: #FFFFFF">
                        Use the form below to create a new account.
                    </p>
                    <br />
                    <p style="color: #FFFFFF">
                        Passwords are required to be a minimum of <%= Membership.MinRequiredPasswordLength %> characters in length.
                    </p>
                    <span class="failureNotification">
                        <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
                    </span>
                    <asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification" 
                         ValidationGroup="RegisterUserValidationGroup"/>
                    <div class="accountInfo">
                        <fieldset class="register">
                            <legend style="color: #FFFFFF">Account Information</legend>
                            <p>
                                <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" 
                                    ForeColor="White">User Name:</asp:Label>
                                <asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" 
                                     CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required." 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                            </p>
                            <p>
                                <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email" 
                                    ForeColor="White">E-mail:</asp:Label>
                                <asp:TextBox ID="Email" runat="server" CssClass="textEntry"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email" 
                                     CssClass="failureNotification" ErrorMessage="E-mail is required." ToolTip="E-mail is required." 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                            </p>
                            <p>
                                <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" 
                                    ForeColor="White">Password:</asp:Label>
                                <asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" 
                                     CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required." 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                            </p>
                            <p>
                                <asp:Label ID="ConfirmPasswordLabel" runat="server" 
                                    AssociatedControlID="ConfirmPassword" ForeColor="White">Confirm Password:</asp:Label>
                                <asp:TextBox ID="ConfirmPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                <asp:RequiredFieldValidator ControlToValidate="ConfirmPassword" CssClass="failureNotification" Display="Dynamic" 
                                     ErrorMessage="Confirm Password is required." ID="ConfirmPasswordRequired" runat="server" 
                                     ToolTip="Confirm Password is required." ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword" 
                                     CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:CompareValidator>
                            </p>
                        </fieldset>
                        <p class="submitButton">
                            <asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Create User" 
                                 ValidationGroup="RegisterUserValidationGroup" CssClass = "redButton"/>
                        </p>
                    </div>
                </ContentTemplate>
                <CustomNavigationTemplate>
                </CustomNavigationTemplate>
            </asp:CreateUserWizardStep>
<asp:CompleteWizardStep runat="server"></asp:CompleteWizardStep>
        </WizardSteps>
    </asp:CreateUserWizard>
Posted
Updated 20-Apr-13 11:56am
v3
Comments
[no name] 20-Apr-13 17:24pm    
"how to edit the register form", I am assuming you mean "registration form", open the code in your favorite editor and write the code that you want to change. That is write the code to add a security question, address and mobile number. Be sure to save it when you are done.
[no name] 20-Apr-13 17:32pm    
how can i add the data from them to the ASPNETDB ??
[no name] 20-Apr-13 19:39pm    
Just like any other database, create a connection (to whatever you think an ASPNETDB is), and write an SQL command to insert the data, then you execute the command. And none of this has anything to do with your question.

 
Share this answer
 
If you click on the Source, there is this hierarchy: _

XML
<asp:CreateUserWizard runat="server" ID="RegisterUser" ViewStateMode="Disabled" OnCreatedUser="RegisterUser_CreatedUser">
        <LayoutTemplate>
            <asp:PlaceHolder runat="server" ID="wizardStepPlaceholder" />
            <asp:PlaceHolder runat="server" ID="navigationPlaceholder" />
        </LayoutTemplate>
        <WizardSteps>
            <asp:CreateUserWizardStep runat="server" ID="RegisterUserWizardStep">
                <ContentTemplate>
                    <p class="message-info">
                        Passwords are required to be a minimum of <%: Membership.MinRequiredPasswordLength %> characters in length.
                    </p>

                    <p class="validation-summary-errors">
                        <asp:Literal runat="server" ID="ErrorMessage" />
                    </p>

                    <fieldset>
                        <legend>Registration Form</legend>
                        <ol>
                            <li>



Scroll to the end of the list and insert there this code:

XML
<li>
                                <asp:Label ID="Label1" runat="server" AssociatedControlID="SecurityQuestion">Security Question</asp:Label>


                                 <asp:Label ID="Label4" runat="server" AssociatedControlID="SecurityQuestion">This is an security code:</asp:Label>
                                <asp:Label ID="SecurityAnswer" runat="server" AssociatedControlID="SecurityAnswer">QR45lt0</asp:Label>
                                <asp:TextBox runat="server" ID="tbSecurityQuestion" />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tbSecurityQuestion"
                                     CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The Security Question field is required." />
                                <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="SecurityAnswer" ControlToValidate="tbSecurityQuestion"
                                     CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The Security answer was wrong." />
                            </li>
                            <li>
                                <asp:Label ID="Label2" runat="server" AssociatedControlID="Address">Address</asp:Label>
                                <asp:TextBox runat="server" ID="tbAddress" />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="tbAddress"
                                     CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The Address field is required." />
                            </li>
                            <li>
                                <asp:Label ID="Label3" runat="server" AssociatedControlID="MobileNumber">Mobile Number</asp:Label>
                                <asp:TextBox runat="server" ID="tbMobileNumber" />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbMobileNumber"
                                     CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The Mobile Number field is required." />
                            </li>



I hope this helped!

If you want it for the database, just use tbMobileNumber.Text and tbAddress.Text as parameters for your OracleCommand or SqlCommand.

Pepin z Hane
 
Share this answer
 
v3
Comments
[no name] 20-Apr-13 17:50pm    
what should i put to take the data from the text boxes to save them in the data base? thanks
Pepin z Hane 20-Apr-13 18:07pm    
and what about tbMobileNumber.Text? Maybe you have asked a wrong question. How do you connect to the database? What database system do you use? How do you insert the data to the database - do you use some object-relational mapping or simple DbCommand?
[no name] 20-Apr-13 18:10pm    
i want the tbMobileNumber to be added to another database into a table named customers .... i took the values of the username and email and added them to that database using session do i do the same for those ?
[no name] 20-Apr-13 18:14pm    
the tbMobileNumber.text isnt working because i put the code in the CreateUserWizardStep is there Another way ... the Id for CreateUserWizard is #RegisterUser
Pepin z Hane 20-Apr-13 18:30pm    
I see,there was a small error. The labels have to have instead AssociatedControlID="SecurityQuestion" this AssociatedControlID="tbSecurityQuestion". But it doesn't work still. Now it is written in the same way as the items of <li> before.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900