How To Assign Validators To A Button
Is there any way to assign a group of asp.net validations to validate when a button is clicked?
I've got two sections in my site. If one section isn't submitted and the user decides to submit the other, I want to prevent the validation from the first section from firing also.
Any suggestions or pointers? Thanks
Set the ValidationGroup on both your validators and button to be the same value to tie them together. In the example below, there are 2 buttons, each one validates one section or the other, but not both.
<asp:RequiredFieldValidator runat="server" ... ValidationGroup="GroupOne" /> <asp:RequiredFieldValidator runat="server" ... ValidationGroup="GroupTwo" /> <asp:Button runat="server" ID="ButtonOne" ... CausesValidation="true" ValidationGroup="GroupOne" /> <asp:Button runat="server" ID="ButtonTwo" ... CausesValidation="true" ValidationGroup="GroupTwo" />
- → Function Undefined in Axios promise
- → React formatting dates with momentjs server side
- → AngularJS directive: "templateUrl" doesn't work while "template" works
- → how to add cannonical tag for ASPX .NET page
- → URL routing requires /Home/Page?page=1 instead of /Home/Page/1
- → ASP.NET routing w/ changing article name
- → NumericTextBox Loses Value using Html.TextBoxFor, not HTML
- → How to do Bundling of css & js files in Drupal
- → Does the fact that every page is reachable through www.example.com and www.example.com/index have any SEO impact?
- → How to add rich snippet in a website?
- → UrlRewriting does not work on server, but on localhost it works fine on asp.net?
- → Bootstrap Nav Collapse via Data Attributes Not Working