Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to fetch dropdown selected value from view in controller to add ModelState error as we added for textbox values for being null?
if (string.IsNullOrEmpty(employee.Name))
{
ModelState.AddModelError("Name","The Name field is required");
}
Ex:When we are creating an Employee if the user selects "Select Department" value from Department dropdown list,we need to add the error stating "Please select the valid Department"
How do we achieve this?
Posted

1 solution

The solution to your problem will become easy if you make use of JQuery Ajax
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900