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. Image for the cookie policy date

Grid: load data only on demand


There is a way to configure the Grid Control to load the data only with the code gridObj1.refreshContent(); and WebMethodAdaptor? I don't want the grid to load the data at begining.


1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team November 6, 2015 09:25 AM UTC

Hi Jorge,

We can bind the dataSource to the Grid later using setModel, after binding the empty dataSource to the Grid at initial render. Please refer to the below code example.

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

    <ej:button id="ButtonNormal" type="Button" runat="server" clientsideonclick="btnClick" text="Button"></ej:button>

    <ej:grid id="EmployeesGrid" runat="server" width="1500px" allowpaging="true">

                <!--DataSource is Empty at intial Render-->


                        <ej:Column Field="OrderID" IsPrimaryKey="true" HeaderText="Order ID" Width="80" />

                        . . .  .




        function btnClick(e) {

            $("#MainContent_EmployeesGrid").ejGrid({ dataSource: ej.DataManager({ url: "Default.aspx/Data", adaptor: new ej.WebMethodAdaptor() }) })



[Code Behind]


        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]

        public static object Data(Syncfusion.JavaScript.DataManager value)


            IEnumerable Data = OrderRepository.GetAllRecords();

            int count = Data.AsQueryable().Count();

            return new { result = Data, count = count };


For your Convenience, we have prepared a sample that can be downloaded from the below location

Sample:  http://www.syncfusion.com/downloads/support/forum/121048/ze/EjGrid-312448390

Seeni Sakthi Kumar S.

Live Chat Icon For mobile
Up arrow icon