I'm following steps of the NerdDinner tutorial. In the dinner Model class where I have error and validation handling for CRUD instead of error notifications in browser I get some kind of debugger dialog. Why is that?
A:
You will need to handle the error in the controller.
public ActionResult Create({YourObject} object)
{
try
{
//Try to save your object.
}
catch(ApplicationException ex)
{
//Do something with the exception.
}
}
Patrik Potocki
2010-05-07 11:42:08
A:
I think it's right there in the code:
if (!isValid)
throw new ApplicationExcption(...)
Instead of throwing an application exception, you need to change that to just pass the Model back to the View.
The ModelState object should have the necessary values, and if you have the Validation message controls in your views, you should see error messages.
CubanX
2010-05-07 12:11:38