Multiple validation problem



I have the following problem: I have two button, tow textboxes and two
RequiredFieldValidator controls, like that:

<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TextBox1"
id="RequiredFieldValidator1" runat="server"
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
<asp:TextBox id="Textbox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TextBox2"
id="Requiredfieldvalidator2" runat="server"
<asp:Button id="Button2" runat="server" Text="Button"></asp:Button>

Can I make the RequiredFieldValidator1 to response only to Button1 and
RequiredFieldValidator2 response only to Button2 ?


Joe Gass

Hi Shahar
The validators that come with .net don't do this
I've developed a set of validator controls that allow you to group them into
logical forms.

<extendedvalidators:RequiredFieldValidator id="RequiredFieldValidator2"
runat="server" ErrorMessage="type something" ControlToValidate="TextBox1"

In the future I'd like to sell them (after a bit more testing)...
If you like to try them mail me at (e-mail address removed) and I'll send
you the dll, let me know if you are using visual studio version 2002 or 2003
Joe Gass

Peter Blum

You are describing a concept called "validation groups" that will be in
ASP.NET 2.0. That product is a long way out. I have a solution that provides
validation groups now and offers much more to help you with validation that
ASP.NET 2.0 and all other validation products do not cover. Take a look at
my product, "Professional Validation And More"

--- Peter Blum
Email: (e-mail address removed)
Creator of "Professional Validation And More" at

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