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.
Unfortunately, activation email could not send to your email. Please try again.

Empty

Thread ID:

Created:

Updated:

Platform:

Replies:

125012 Jul 14,2016 07:41 AM Jul 18,2016 01:57 AM ASP.NET Web Forms 1
loading
Tags: Grid
Hrvoje Voda
Asked On July 14, 2016 07:41 AM

How can i have an empty grid on page load and refill it later with some search parameters?
Now I', getting an error that grid cannot be empty on load.

Alan Sangeeth S [Syncfusion]
Replied On July 18, 2016 01:57 AM

Hi Hrvoje, 

Thanks for using Syncfusion products. 

Query 1: “empty grid on page load and refill it later” 

We are glad to let you know that we have achieved your requirement and created a sample which can downloadable from below link. 


In the above sample we have not bounded any data to Grid control at initial load. On a button click event, using DataManager we have sent post-back to retrieve data from server-side and we have used addParams” method of ejQuery to send additional parameter. Then in DataManager done event, we have updated data to grid using “dataSource” Grid method. Please refer to the following code example and documentation links. 
<ej:Button ID="ButtonNormal" runat="server" Type="Button" ClientSideOnClick="ButtonNormal_Click" Text="Update Grid"></ej:Button> 
    <ej:Grid ID="EmployeesGrid2" runat="server" AllowPaging="True"> 
 
</ej:Grid> 
 
    <script> 
        function ButtonNormal_Click(args) { 
            var gridObj = $('#<%= EmployeesGrid2.ClientID %>').data("ejGrid"); 
            var query = new ej.Query().addParams("param23", 5); 
            $('#<%= EmployeesGrid2.ClientID %>').ejWaitingPopup("show"); 
            ej.DataManager({ url: "Default.aspx/DataSource", adaptor: new ej.WebMethodAdaptor()}).executeQuery(query).done(function (e) { 
                gridObj.dataSource(e.result); 
                $('#<%= EmployeesGrid2.ClientID %>').ejWaitingPopup("hide"); 
            }); 
        } 
    </script> 


Documentation links: 

 
Query 2: “getting an error that grid cannot be empty on load 

We suspect that you have not defined any Grid columns and loaded empty data which may be the cause of the issue.  

It is necessary to provide either datasource or define Grid columns at initial load. When we do not provide both datasource and Grid columns, it is not feasible to render Grid since there is no information on number of columns and its names. 

Regards,
Alan Sangeeth S 


CONFIRMATION

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.

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.

;