I have an idea which I dont know how to implement. In MVC 3 controller I have an if statement, and I want t开发者_开发百科he controller to return an error message if the if statement fails. And I have a ValidationSummery on that page, so its better if it will catch the error message and present it..
How do I do this?
Thanks
In the controller you can add an error message by
ModelState.AddModelError(string key, string errorMessage);
精彩评论