ASP.NET - CreateUserWizard Validation??? - Asked By KCH on 15-Jun-12 02:19 AM

Hi friends,
I am using CreateUserWizard control for User Registration.It is checking only required field but i want to do more validations like only integers,characters etc....Please suggest me how to do...... 
Jitendra Faye replied to KCH on 15-Jun-12 02:20 AM
For this you can customize CreateUserWizard , and after that you can add validation control to form for validating the controls.
Chintan Vaghela replied to KCH on 15-Jun-12 02:38 AM

Hi Frndz,

 

Functionality:  Javascript Validation for CreateUserWizard

 

Find Control as following way

 

document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName").ClientID %>');

 

Call javascript function on CustomNavigationTemplate Button

 

<CustomNavigationTemplate>

            <asp:Button ID="StepNextButton" runat="server" OnClientClick="return ValidationCreateUserWizard();"

              Text="Create User" />

          </CustomNavigationTemplate>

 

 

Logic:

 

 

function ValidationCreateUserWizard() {

 

 

      var txtUserName = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName").ClientID %>');

      if (txtUserName.value == '') {

        alert("Blank not allowed");

        return false;

      }

      return true;

 

    }

 

SAMPLE for CreateUser Wizard

 

  <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" ContinueDestinationPageUrl=""

      LoginCreatedUser="False" Width="100%" RequireEmail="false" a AutoGeneratePassword="true">

      <WizardSteps>

        <asp:CreateUserWizardStep runat="server" Title="" ID="Details">

          <ContentTemplate>

            <table width="100%">

              <tr>

                <td>

                  User Name :

                  <asp:TextBox ID="UserName" runat="server"></asp:TextBox>

                 

                </td>

              </tr>

            </table>

          </ContentTemplate>

          <CustomNavigationTemplate>

            <asp:Button ID="StepNextButton" runat="server" OnClientClick="return ValidationCreateUserWizard();"

              Text="Create User" />

          </CustomNavigationTemplate>

        </asp:CreateUserWizardStep>

        <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">

          <ContentTemplate>

          </ContentTemplate>

        </asp:CompleteWizardStep>

      </WizardSteps>

      <FinishNavigationTemplate>

      </FinishNavigationTemplate>

      <StepNavigationTemplate>

      </StepNavigationTemplate>

      <StartNavigationTemplate>

      </StartNavigationTemplate>

    </asp:CreateUserWizard>

 

Hope this helpful!

Thanks

 

 

KCH replied to Chintan Vaghela on 15-Jun-12 03:42 AM
Thank you....
Chintan Vaghela replied to KCH on 15-Jun-12 06:11 AM
welcome :)