Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Validation Controls with multiple submit buttons

enter image description here

There are two submit buttons on web form, Required field validation is there, i want if i click first submit button, it doesn't check the second submit. Mean i only want that only first text box Required validation must work? what should i have to do that i can segregate validation on multiple submit buttons For more detail, snap shot is included.

like image 579
Abdul Khaliq Avatar asked Mar 27 '26 16:03

Abdul Khaliq


1 Answers

What you need is validationGroup property

The required Filed Validator will have following property

 <asp:requiredfieldvalidator id="RequiredFieldValidator2"
      ...
      validationgroup="Group1"
      ...
      runat="Server">
    </asp:requiredfieldvalidator>

And associated button

 <asp:button id="Button1" 
      text="Validate" 
      causesvalidation="true"
      validationgroup="Group1"
      runat="Server" />

In this way you can organise which validation to perform on any specific button click

like image 179
Anand Avatar answered Mar 31 '26 08:03

Anand



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!