Validation Groups

M

moondaddy

How can I have a page with 2 different groups of controls (where each group
of controls contain textboxes, validation controls and a submit button) and
each group operate independently? for example, when the user clicks on the
first submit button, it wont submit unless all the controls in group 1 are
valid, likewise, when the user clicks on the 2nd submit button, it wont
submit unless all the controls in group 2 are valid.

thanks.
 
T

Teemu Keiski

Using ASP.NET 2.0? Doesn't just specifying ValidationGroup="your_group_name"
on these controls respectively work?
 
S

Steven Cheng[MSFT]

Hello Moondaddy,

If you're developing the page through ASP.NET 2.0, as Teemu has suggested,
you can consider utilize the ValidationGroup in ASP.NET 2.0. This is a new
feature added in ASP.NET 2.0 react to the feedback about the ASP.NET 1.1
validation control's limitation. We can configure validation controls,
summarycontrol, submit buttons to be grouped by certain group names and a
submit button configured in a certain group can only trigger the valiation
of validators in that corresponding group.

#Specifying Validation Groups
http://msdn2.microsoft.com/en-us/library/ms227424.aspx

#Changes to the Validation Controls in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms379607.aspx


So for your scenario, each of your usercontrol will has own set of input
entries and validation controls, you can consider make each usercontrol an
individual Validation Group scope so that the validation in one
usercontrol(group) won't affect the ones in another usercontrol(group).

The above msdn link has provided typical sample demonstrating the usage of
validation group of ASP.NET 2.0 validators.

Please feel free to post here if there is anything unclear or any other
questions on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,991
Messages
2,570,212
Members
46,800
Latest member
Tobi1987

Latest Threads

Top