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

The SfGrid.Rows.Count Solution

small thing - but I find no documentation at all.

Since there is no Sfdatagrid.rows.count property I would appreciate an alternative way to solve my issue.

> I have two buttons to change the selected index (up & down) of my sfdatagrid
ex. / vb: sfdatagrid.selectedindex = sfdatagrid.selectedindex +1
to not get the out_of_range exeption i need the last index / row.count value to stop it before it hits the line

> How do I get the last index / rows.count value ?


4 Replies

AR Arn August 24, 2015 07:29 PM UTC

Hi SigRist.

The answer to Your quest in C#:

  int NumberOfRows = sfDataGrid.View.Records.Count();

Ciao

Arn


ES Elangovan S Syncfusion Team August 25, 2015 02:03 PM UTC

Hi Sigrist,

Thank you for using Syncfusion product,

As per Arn’s update we can get the Rows Count by using the SfDataGrid.View.Records.Count property. To handle the out_of_range exception, it is possible to create the appearance and behavior of the RecordNavigationBar in the SfDataGrid by programmatically changing the SfDataGrid.SelectedIndex. To select the previous row or the next row, the SfDataGrid.SelectedIndex value is incremented or decremented, for more details you can refer the following KB article link.

KB Link: http://www.syncfusion.com/kb/5303/how-to-accomplish-recordnavigationbar-in-the-sfdatagrid-like-syncfusion-windowsforms-databoundgrid
 
Please let us know if you have any other query.

Regards,

Elangovan S




SI Sigrist August 25, 2015 08:47 PM UTC

Thank you very much ! Solved my problem !



ES Elangovan S Syncfusion Team August 26, 2015 03:58 AM UTC

Hi Sigrist,
 
Thanks for your update,
 
Please let us know if you have any more queries,
 
Regards,
Elangovan S

Loader.
Live Chat Icon For mobile
Up arrow icon