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 is loosing data on any postback on the page

Hi Team,

On the fresh page load, I am binding data to Grid and it is displaying perfectly. If I click any button, the Grid is loosing the data.
Can you please let me know how to maintain the data binded to Grid even after postback.

Also, please let me know the javascript files required for proper functioning of Grid control.

Thanks,
Suresh.

3 Replies

MS Mani Sankar Durai Syncfusion Team July 27, 2017 12:17 PM UTC

Hi Kadam, 

Thanks for contacting Syncfusion support. 

Query 1: Can you please let me know how to maintain the data binded to Grid even after postback. 
   We have analyzed your query and we are not able to reproduce the reported issue. We suspect that you haven’t bind the data for the grid on Page_Load method in code behind. So we suggest you to bind the data to the grid in the Page_Load. 
Refer the code example 
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">   
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
  <asp:Button ID="button" Text="Click" runat="server" ></asp:Button> 
    <ej:Grid ID="Grid" runat="server"  AllowPaging="True" > 
        <Columns> 
... 
                
            </Columns> 
        </ej:Grid>  
</asp:Content> 
 
List<Orders> order = new List<Orders>(); 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            BindDataSource(); 
        } 
 
        private void BindDataSource() 
        { 
            int code = 10000; 
            for (int i = 1; i < 10; i++) 
            { 
                        ... 
            } 
            this.Grid.DataSource = order; 
            this.Grid.DataBind(); 
        } 
 
We have also prepared a sample that can be downloaded from the below link. 
Refer the documentation link of about binding data to the grid 
 
Query 2: Also, please let me know the javascript files required for proper functioning of Grid control 
 
Refer the documentation link of about referring the required JS files 
 
 
To refer the individual files to render the grid control refer the documentation link. 
 
Please let us know if you need further assistance. 
 
Regards, 
Manisankar Durai. 
 
 




KS Kadam, Suresh B. (WTIC 535) CWR July 31, 2017 12:56 PM UTC

Hi Mani,

Thank you, issue has been resolved with your suggestion.

Regards,

Suresh.



MS Mani Sankar Durai Syncfusion Team August 1, 2017 04:26 AM UTC

Hi Suresh, 

We are happy to hear that your problem has been solved. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 


Loader.
Up arrow icon