HTML:
<div>
<asp:TextBox ID="TextBox1" Runat="server" ValidationGroup="First"></asp:TextBox>
<asp:TextBox ID="TextBox2" Runat="server" ValidationGroup="First"></asp:TextBox><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ValidationGroup="First"
ErrorMessage="TextBox1 should not be blank" ControlToValidate="TextBox1">
</asp:RequiredFieldValidator>
<asp:Button ID="Submit1" Runat="server" ValidationGroup="First" Text="Submit 1" />
<br />
<br />
<asp:TextBox ID="TextBox3" Runat="server" ValidationGroup="Second"></asp:TextBox>
<asp:TextBox ID="TextBox4" Runat="server" ValidationGroup="Second"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server" ErrorMessage=" TextBox3 should not be blank"
ControlToValidate="TextBox3" ValidationGroup="Second">
</asp:RequiredFieldValidator>
<asp:Button ID="Submit2" Runat="server" ValidationGroup="Second" Text="Submit 2" />
</div>
Use of Validation Group is shown above
Thanks
RajShree
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Sanjay VermaPosted Nov 11, 2020, 12:53 AM
Validation group showing are all errors in one alert message.
Anas shaikhPosted Apr 29, 2015, 4:27 AM
What is the use of putting ValidationGroup in textbox2 and textbox4, if it not validating it??