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

Correct way to implement DataGrid in PartialView

Thread ID:





143685 Apr 1,2019 08:13 AM UTC Apr 3,2019 04:36 AM UTC ASP.NET Core - EJ 2 3
Tags: DataGrid
Asked On April 1, 2019 08:13 AM UTC

Hi there,

I am currently using EJ2 Grid as partial view components, so far it's working great. I am able to get and set the data successfully.

But I am now facing an issues where I can't get the correct selected record on 2nd load, where the grid will return me the value from 1st data set.

Details step below, with sample data.
  1. The grid is load with first set of data on load.
  2. Click on 1st row, return 1.
  3. Click on 4th row, return 4.
  4. Load the second set of data by clicking load button with filter text from input.
  5. Click on 1st row, return 1.
  6. Click on 4th row, return 8.
First set of data: { 1, 2, 3 , 4, 5, 6, 7, 8, 9, 10 }
Second set of data: { 2, 4, 6, 8, 10 }

Attach is the code I used, is there anyway I am doing wrong on this or some additional setup are required for the partial view script to run on second load.

Attachment: Sample_f8f5faa7.zip

Pavithra Subramaniyam [Syncfusion]
Replied On April 2, 2019 12:30 PM UTC

Hi Skye, 

Greetings from the Syncfusion support, 

We have analyzed the provided a code example and found that you have bounded the server returned result in innerHTML of Grid in Ajax.Success function from the loadData method. In this case, you have bound the result value to EJ2 Grid DOM Element instead of Grid dataSource. you can update the Grid’s dataSource using that result value. So that the Grid data will be refreshed and will provide the correct record on Grid row selection. Could you please provide more information about your query that will be helpful for us to provide a better solution as soon as possible. 

  1. Share the video to demonstrate the issue.
  2. Share the result returned from the ajax call.
  3. If possible share code example or sample for further analysis.
Pavithra S. 

Replied On April 3, 2019 12:25 AM UTC


I actually manage to fixed this issue by using (args).

function rowSelected(args) {
            const index = args.rowIndex();

             var selectedrecord = args.data;



Pavithra Subramaniyam [Syncfusion]
Replied On April 3, 2019 04:36 AM UTC

Hi Skye,  

Thanks for your update. 

We are happy to hear that you have resolved the issue. 

Please contact us if you need any further assistance. As always, we will be happy to assist you.  

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