Skip to content
Loading
Validation not working
  • Hi Sachin
     
       In Controller i have done. It's working. How to display errors at Client Side when user clicks on Submit.
     
    Thanks 
  • Sachin Singh
    It simply means you have not used ModelState.IsValid on the Action method
     It is the ModelState that collects all the errors and the value as a key-value pair as it is a dictionary.
    1. public ActionResult CreateEdit(Location obj)  
    2. {  
    3. if(ModelState.IsValid)  
    4. {  
    5.   
    6. // do your work  
    7.   
    8.   
    9.   
    10. }  
    11.   
    12.   
    13.   
    14.   
    15. }