Hi,
in above code i have made some changes in getDetails action method
public ActionResult GetDetails()
{
try
{
throw new Exception("Exception");
}
catch (Exception ex)
{
ModelState.AddModelError("Error", ex.Message);
var result = ModelState.ToDataSourceResult();
return Json(result, JsonRequestBehavior.AllowGet);
}
}
can you please dipslay error count in below action method
public ActionResult Index()
{
var result = GetDetails();
//int count = (((JsonResult)result).Data as List<Employee>).Count;
ViewData["Message"] = "Record count : " + count;
return View();
}