Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Validation Group in asp.net

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 272
    Comment on it

    Try to understand it with an Example:consider the image below.

    alt text

    Here the problem is that whenever I'll click on Login button, only textboxes of the Login section(UserName and Password) needs to be validated. And whenever I'll click on the "Register" button, only textboxes in the User Registration section(Email, UserName, Password and ConfirmPassword) needs to be validated.

    But firstly when you will implement it you will get to know that after clicking on Login button of Login section,all fields will be validated(LOGIN SECTION fields as well as USER REGISTRATION fields).

    So, how do I prevent validation from happening in both the section together?

    We can use **Validation Group Property** to prevent this situation If we don't use validation groups, then by default, whenever, you click a button, all the validation controls on the page get validated.

    So, whenever you will click on the login button and if, you want to validate only the fields of Login section(UserName and Password), then you have to set, the ValidationGroup property of validation controls and the login button control to the same group name. So all the Controls in login section will have same ValidationGroup name and you have to use a different group name for the validation controls and register button, in the registration section.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: