This is a migrated thread and some comments may be shown as answers.

How to create Modal State Errors

1 Answer 349 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Meerkat
Top achievements
Rank 1
Meerkat asked on 12 Apr 2013, 04:12 PM
Hello,
There seem to be several examples dotted around the place on how to handle Model State errors
e.g. How do I display model state errors?
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq
However I cannot find any documentation on how to create the error on the server in the first place.
Any hint of what needs to replace the comments shown below, would be much appreciated.
Regards,
Pete
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Update_User([DataSourceRequest] DataSourceRequest request, UserProfile userprofile)
{
  if (userprofile != null && ModelState.IsValid)
  {
    if (errorcondition)
    {
      //raise something here that will be picked up by the onError function described above
      //to inform the user that some sort or error occured
    }
  }
  else
  {
    //raise something here that will be picked up by the onError function described above
    //to inform the user that the ModelState.IsValid is Invalid
  }
  return Json(ModelState.ToDataSourceResult());
}


1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 16 Apr 2013, 11:16 AM
Hi Pete,

 
I would suggest to check the "Handling server-side validation errors during pop-up editing" demo in our CodeLibrary which demonstrates how to handle server-side validation errors (add them to the ModelState) and to display the validation message within the edit form.

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Meerkat
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or