This question is locked. New answers and comments are not allowed.
Hi,
I am trying to implement ajax editing (Popup mode) in Telerik Q2 grid. The Model is EntityFramework model which has data annotation for various property validation. After submitting the ajax edit form, if there are any errors related to the Model annotations, these errors show up correctly. However if I use ModelState.AddModelError() add business errors to model, these errors does not show in the grid ajax edit form. Is it possible to display business error message like the ones that are displayed when the TryUpdateModel() fails ?
Here is the simplified code that I am using
regards,
Nirvan.
I am trying to implement ajax editing (Popup mode) in Telerik Q2 grid. The Model is EntityFramework model which has data annotation for various property validation. After submitting the ajax edit form, if there are any errors related to the Model annotations, these errors show up correctly. However if I use ModelState.AddModelError() add business errors to model, these errors does not show in the grid ajax edit form. Is it possible to display business error message like the ones that are displayed when the TryUpdateModel() fails ?
Here is the simplified code that I am using
<!-- Model Editor Template -->
@Html.ValidationSummary()
<
div
class
=
"content"
>
@{Html.RenderPartial("_UserEdit");}
</
div
>
//Controller
[GridAction][HttpPost]
public
ActionResult _UserUpdate(
int
id) {
User user = userManager.FindUser(id);
if
(user !=
null
) {
if
(TryUpdateModel(user)) {
try
{
userManager.EditUser(user);
}
catch
(Exception ex) {ModelState.AddModelError(
"RepositoryException"
,ex.Message);
//Does not show up
}
}
}
return
View(
new
GridModel(userManager.GetQueryableUsers()));
}
regards,
Nirvan.