Razor Pages grid view ajax

Dear,

I am looking for an example to display the data in grid view using asp.net core razor page ajax.

Kindly share the example to achieve it.

regards
prasad

3 Replies 1 reply marked as answer

VS Vignesh Sivagnanam Syncfusion Team January 22, 2021 08:18 AM UTC

Hi prasad 

Greetings from Syncfusion support 

Based on your query you want to display the grid data by using ajax request in the razor page. For your requirement we have prepared a sample by binding the data to the grid by the ajax request in the grid “created” event. Please refer the below code example and sample for your reference  

Code Example : 
<ejs-grid id="Grid" allowPaging="true" toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel"})" created="create()"
    ……………… 
</ejs-grid

<script> 
  function create() { 
    var ajax = new ej.base.Ajax("/Index?handler=ClickHandle", 'GET'); 
    ajax.send(); 
    ajax.onSuccess = function (data) { 
      var grid = document.getElementById('Grid').ej2_instances[0]; // Grid instance 
      grid.dataSource = ej.data.DataUtil.parse.parseJson(data); 
    } 
  } 
    </script> 


Please let us know if you have any concerns. 

Regards, 
Vignesh Sivagnanam 


Marked as answer

AA Abdul Abdulai October 17, 2022 09:22 AM UTC

Hi  Vignesh ,

Thanks for this answer. It has helped me, I have being trying to do this for a while now until I came across this solution. YOU GUYS Rock!

Kind Regards,

Zak



VB Vinitha Balasubramanian Syncfusion Team October 18, 2022 06:13 PM UTC

Hi Abdul Abdulai,


Thanks for your update.


We are happy to hear that issue has been resolved.


Please get back to us, if you need further assistance.


Regards,

Vinitha Balasubramanian


Loader.
Up arrow icon