I am new to MVC4. Here I added the ModelState.AddModelError message to display when the delete operation is not possible.
-
RedirectToAction
will clear ModelState
. You must return a view in order to use this data. Therefore, the first if
case won't work. Also, ensure that you have a control in your view (like ValidationSummary
) which displays the error... this could be the problem in the second case.
- 热议问题