Hi All,
I am making ajax call from grid to the server side and when there is an error happen on the server than no error shown on the grid. I am using example from trial download on Hierarchical example
Here is view code:
and here is controller code
My question is if grid itself doesn't handles exception on Ajax call, how to handle those sort of exceptions?
Thanks.
I am making ajax call from grid to the server side and when there is an error happen on the server than no error shown on the grid. I am using example from trial download on Hierarchical example
Here is view code:
@(Html.Kendo().Grid<
Kendo.Mvc.Examples.Models.EmployeeViewModel
>()
.Name("Employees")
.Columns(columns =>
{
columns.Bound(e => e.FirstName).Width(140);
columns.Bound(e => e.LastName).Width(140);
columns.Bound(e => e.Title).Width(200);
columns.Bound(e => e.Country).Width(200);
columns.Bound(e => e.City);
})
.ClientDetailTemplateId("employeesTemplate")
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_Employees", "Grid"))
.PageSize(5)
)
.Sortable()
.Events(events => events.DataBound("dataBound"))
)
<
script
id
=
"employeesTemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
Kendo.Mvc.Examples.Models.OrderViewModel
>()
.Name("Orders_#=EmployeeID#")
.Columns(columns =>
{
columns.Bound(o => o.OrderID).Width(101);
columns.Bound(o => o.ShipCountry).Width(140);
columns.Bound(o => o.ShipAddress).Width(200);
columns.Bound(o => o.ShipName).Width(200);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=EmployeeID#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</
script
>
<
script
>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</
script
>
and here is controller code
using System;
using System.Web.Mvc;
using System.Linq;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
namespace Kendo.Mvc.Examples.Controllers
{
public partial class GridController : Controller
{
public ActionResult Hierarchy()
{
return View();
}
public ActionResult HierarchyBinding_Employees([DataSourceRequest] DataSourceRequest request)
{
throw new Exception("Test");
}
public ActionResult HierarchyBinding_Orders(int employeeID, [DataSourceRequest] DataSourceRequest request)
{
return Json(GetOrders()
.Where(order => order.EmployeeID == employeeID)
.ToDataSourceResult(request));
}
}
}
My question is if grid itself doesn't handles exception on Ajax call, how to handle those sort of exceptions?
Thanks.