Hi All,

I have 6 fields (3 on the top) and (3 on the bottom). The 3 on the top are:

Current email:
New email:
Confirm email:
<Submit> <Cancel>

Current password:
New password:
Confirm password:
<Submit> <Cancel>

Also each one has a required field validations.

Now if someone fills the email section and presses submit, I get missing fields error in the password section. My question is how to separate the two section so that the submit button causes validation only to the fields its associated with?


I LOVE ME! :) I found the answer to my question. I should by myself a cookie...

Anyways, the way to do it is by creating two User Controls. Each one will validation itself only!

I'm still going to test it.

From MSDN article - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.commandfield.causesvalidation.aspx

Use the CausesValidation property to specify whether validation is performed when a button in a CommandField field is clicked. When this property is set to true, by default all validation controls on the page are validated. To limit validation to only a certain group of validation controls, create a validation group and then set the ValidationGroup property to the validation group's name.

commented: Very accurate - Great answer +1

I wonder why this was moved, his is of interest in the C# forum too:(

I wonder why this was moved, his is of interest in the C# forum too:(

No worries. I got my answer. It's a combination of C# and asp.net.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.