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

Changing Datasource & Refresh the data of a grid

Thread ID:





143742 Apr 3,2019 03:55 PM UTC Apr 4,2019 06:28 AM UTC ASP.NET Core - EJ 2 1
Tags: DataGrid
John Stephen Mangam
Asked On April 3, 2019 03:55 PM UTC


Could you please let me know how I could change the datasource URL on a click of a button to another urlAdaptor?

Also, could you please let me know how I could refresh a grid so that it fetches from the server?


Pavithra Subramaniyam [Syncfusion]
Replied On April 4, 2019 06:28 AM UTC

Hi John, 
Thanks for contacting Syncfusion support. 
You can change the data url and refresh the Grid component by simple changing the Grid dataSource property inside the button click event. Please refer to the below code example and documentation link for more information. 
<ejs-button id="change" content="change"></ejs-button> 
<ejs-grid id="DataGrid" allowPaging="true"> 
    <e-data-manager url="/Home/UrlDataSource" adaptor="UrlAdaptor" crossdomain="true"></e-data-manager> 
    <e-grid-pagesettings pageSize="10"></e-grid-pagesettings> 
        <e-grid-column field="OrderID" width="80"></e-grid-column> 
        .  .   
        var grid = document.getElementById("DataGrid").ej2_instances[0]; 
        //changing the dataSoure will automatically refresh the Grid 
        grid.dataSource = new ej.data.DataManager({ 
            url: "Home/NewData", 
            adaptor:new ej.data.UrlAdaptor() 
Please get back to us if you need further assistance. 
Pavithra S. 


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon