Saturday, March 31, 2018

ASP.NET MVC, multiple forms - show only one validation summary?

I have two forms, one for a searchfilter with dropdowns (submit button is called Filter), and one for a textbox search (submit called Search). They each have errors added to modelstate in the controller for erroneous input, but I want to exclude the searchfilter errors if I use the Search button and exclude the textbox search errors if I use the Filter button.

ValidationSummary doubles my errors in both places (as expected) and ValidationMessage using the specific key for the error shows them in each location at all times.

How do I only grab the errors I want for each button and exclude the other form's errors?

ASP.NET MVC, multiple forms - show only one validation summary? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team