Set more than one ValidationGroup to a Button?

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

ASP.NET 2.0

Is it possible to set more than one ValidationGroup to a Button?

I have two sets of controls on a Web page, into two different
ValidationGroups. I would like when the user clicks on a specific button,
that both groups be validated.

Thanks.
Michael
 
C

Christopher Reed

I don't see any way of this directly using the .NET 2.0 Framework. I'm
sure, given the time, you could come up with a custom Button object and
custom Validation object that could handle it.

Another option could be to use the CustomValidator object. It provides with
both server and client validation functionality, but I'm not how complex it
might be with your validation needs. It's at least worth a look.
 
P

Peter Blum

With validation groups in ASP.NET 2.0, you can only match a button to one
group name.

Just so you know that the option exists, my replacement for the Microsoft
validators, "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx) offers validation groups with the
extensions that you need. You can use "*" in the button's Group property to
fire all validation groups. Similarly, the ValidationSummary can have a
group name of "*" to show all validators on the page, if you like.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
Joined
Nov 7, 2008
Messages
1
Reaction score
0
not a real solution...

I had same problem and I used this little workaround....and it worked:

I had the Button1 associated to a validation group but I would like to add a validator (validatorCountry) of a different group to be also checked...so I added this in the click event of the Button1:
Code:
validatorCountry.Validate();
A bit "dirty" but simple...
Carlo
 
Joined
Dec 23, 2008
Messages
1
Reaction score
0
you can use following code

<asp:button onclientclick="javascript: Page_clientValidate('validationgroup1');Page_clientValidate('validationgroup2');" ....../>
 
Last edited:

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,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top