Dimiter:
In the MasterChildDemo the child grid's data source is
.DataSource(ds => ds
.Ajax()
.ServerOperation(
false
)
.Read(read => read.Action(
"Orders"
,
"Home"
))
)
and, as you state, read is invoked once from javascript when a row in the master grid is selected
$(
"#Child"
).data(
"kendoGrid"
).dataSource.read({ employeeId: empId });
My question is the implementation of the HomeController Orders request handler. Specifically the signature of the method.
Why are there two similar args: employeeID and employeeId ?
How does asp server go from receiving a POST with form data like sort=&group=&filter=&employeeId=1 to matching up with the proper ActionResult handler ?
public
ActionResult Orders(
int
employeeID, [DataSourceRequest] DataSourceRequest request,
int
employeeId)
{
NorthwindEntities db =
new
NorthwindEntities();
var orders = db.Orders.Where(o => o.EmployeeID == employeeId).Select(p =>
new
OrderViewModel()
{
OrderID = p.OrderID,
ShipCountry = p.ShipCountry,
ShipCity = p.ShipCity
});
return
Json(orders.ToDataSourceResult(request));
}