Hi Jorge,
Thanks for contacting Syncfusion support.
While using webMethod Adapter, we suggest you to convert data table to list before assigning data to the grid.
Please find the code example and sample:
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowGrouping="true" AllowPaging="True"> <DataManager Adaptor="WebMethodAdaptor" URL="/Default.aspx/Data"/> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> <Columns> <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="100" /> <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="100" /> <ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="100" /> </Columns> </ej:Grid> <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString %>" SelectCommand="SELECT * FROM [Orders]"></asp:SqlDataSource> </asp:Content> ----------------------------------------------------------------------------- public static object Data(Syncfusion.JavaScript.DataManager value) { var data = GetGridDT(); DataResult ds = new DataResult(); DataOperations obj = new DataOperations(); var emp = (from DataRow row in data.Rows select new OrderTable { OrderID = Convert.ToInt32(row["OrderID"]), CustomerID = row["CustomerID"].ToString(), EmployeeID = Convert.ToInt32(row["EmployeeID"]), ShipCountry = row["ShipCountry"].ToString() }).ToList(); ds.result = obj.Execute(emp, value); ds.count = emp.Count; return ds; } |
Sample: http://www.syncfusion.com/downloads/support/forum/121099/ze/WebApplication211928991356
Regards,
Prasanna Kumar N.S.V