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

GetRowIndexByPrimaryKeyAsync return -1


i want to select row by using GetRowIndexByPrimaryKey(Async) method but it returns always -1

1- Syncfusion version is 21.1.37

2- i have data and the row id in page when i execute the databoundHandler methode

3- the grid configuration begins with :

<SfGrid DataSource="@_ofProdDataSource" AllowFiltering="true" AllowPaging="false" AllowSelection="true" EnableAltRow="false" Height="100px" @ref="MyGrid">

<GridEvents TValue="HandAdditionOfProd" OnDataBound="DataBoundHandler" RowSelected="SelectProduction" />


<GridColumn Field="IdFabrication" HeaderText="Number" Width="100" IsPrimaryKey="true" />

4- the methode used is :

public async void DataBoundHandler(BeforeDataBoundArgs<HandAdditionOfProd> args)


await Task.Delay(200);

var selectedOfIndex = await MyGrid.GetRowIndexByPrimaryKey(106152);

await MyGrid.SelectRow(selectedOfIndex);



3 Replies

NP Naveen Palanivel Syncfusion Team April 21, 2023 02:08 AM UTC

Hi Julien,

We checked your query and we prepared sample in lates version(21.1.41) based on given code snippet. But reported issue does not occurs at our end, GetRowIndexByPrimaryKeyAsync does not return the -1 value index when the given value within the grid. We also would like to inform that, GetRowIndexByPrimaryKeyAsync returns -1 when then the given filed value does not have in the grid , it returns -1 to indicate given value is not in grid . Please refer the attached sample for your reference.

If the reported issue still reproduced then kindly share the below details to validate further at our end.

  1. Share us the video demonstration of the issue in provided sample.
  2. Is -1 return after the given value present in the grid?
  3. If possible share us an simple issue reproduceable sample or try to modify the above mentioned sample.

The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible


Naveen Palanivel

Attachment: Blazor_0410_(2)_c5c44493.zip

JG Julien Gambini April 21, 2023 11:35 AM UTC

Hi Naveen,

it's works good with  21.1.41 version !


NP Naveen Palanivel Syncfusion Team April 24, 2023 01:50 PM UTC

Hi Julien,


Please get back to us if you need further assistance.


Naveen Palanivel.

Live Chat Icon For mobile
Up arrow icon