<ej:Grid ID="EmployeesGrid" runat="server AllowPaging="true" >
<DataManager URL="Default.aspx/Data" Adaptor="WebMethodAdaptor" UpdateURL="Default.aspx/Update" InsertURL="Default.aspx/Add" RemoveURL="Default.aspx/Remove" />
<EditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" EditMode="InlineForm" />
<Columns>
<ej:Column Field="OrderID" IsPrimaryKey="true" HeaderText="Order ID" Width="80" />
..
</Columns>
</ej:Grid>
Default.aspx.cs
// URL Adaptor using server side
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object Data(Syncfusion.JavaScript.DataManager value)
{
..
Data = operation.Execute(Data, value);// Execute used for for manual typecasting of columns value while filtering, sorting, or any other data operation
return new { result = Data, count = count }; // need to return result and count pair
}
// Perform Update action
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object Update(Order value)
{
// code for update operation
..
}
// Perform Delete action
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object Delete(int key)
{
.. // code for delete operation
}
// Perform Add action
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object Add(Order value)
{
.. // code for add operation
} |