|
script type="text/javascript">
$(function () {
// the datasource "window.gridData" is referred from jsondata.min.js
$("#Grid").ejGrid({
dataSource: ej.DataManager({
url: "Home/DataSource",
updateUrl: "Home/Update",
insertUrl: "Home/Insert",
removeUrl: "Home/Delete",
adaptor: "UrlAdaptor"
}),
allowPaging: true,
columns: [
{ field: "OrderID",isIdentity:true, isPrimaryKey:true, headerText: "Order ID", width: 80 },
{ field: "ShipCity", headerText: "Ship City", width: 90, priority: 2 },
{ field: "ShipCountry", headerText: "Ship Country", width: 90 }
],
});
});
Serverside:-
public static void Insert(Order value)
{
value.OrderID = ++count; //Auto increment the value for isIdentity property
ord.Add(value);
return Json(value, JsonRequestBehavior.AllowGet);
} |