We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid control: Binding with a System.Data.DataTable object

Thread ID:





121099 Nov 10,2015 05:29 PM UTC Nov 12,2015 03:54 PM UTC ASP.NET Web Forms 1
Tags: Grid
Jorge Pampin
Asked On November 10, 2015 05:29 PM UTC


If I bind my grid control with a System.Data.DataTable object by code behind there is no problem:

this.GdCuentas.DataSource = EA.ObtenerTabla(tipoEntidad);

But, if I bind my grid control by WebMethod and WebMethodAdaptor it doesn't work:

        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static object GetRecursos(Syncfusion.JavaScript.DataManager value,Guid idPadre, string sesion)
            DataResult result = new DataResult();

                SAVE.SAVEDMDB.Sesion.EscenarioAbierto EA = System.Web.HttpContext.Current.Session[sesion] as SAVE.SAVEDMDB.Sesion.EscenarioAbierto;

                SAVE.SAVEDMDB.DataModel.DsEscenario.RecursosDataTable RDT = EA.ObtenerTabla(SAVE.SAVECommon.TipoEntidad.Recursos) as SAVE.SAVEDMDB.DataModel.DsEscenario.RecursosDataTable;

                result.result = RDT;
                result.count = RDT.Rows.Count;

            return result;



Prasanna Kumar Viswanathan [Syncfusion]
Replied On November 12, 2015 03:54 PM UTC

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>
                <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" />
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString %>"
            SelectCommand="SELECT * FROM [Orders]"></asp:SqlDataSource>  
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()
            ds.result = obj.Execute(emp, value);
            ds.count = emp.Count;
            return ds;


Sample: http://www.syncfusion.com/downloads/support/forum/121099/ze/WebApplication211928991356



Prasanna Kumar N.S.V


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon