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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

The SfGrid.Rows.Count Solution

Thread ID:





120024 Aug 24,2015 06:58 PM UTC Aug 26,2015 03:58 AM UTC WPF 4
Tags: SfDataGrid
Asked On August 24, 2015 06:58 PM UTC

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 ?

Replied On August 24, 2015 07:29 PM UTC

Hi SigRist.

The answer to Your quest in C#:

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



Elangovan S [Syncfusion]
Replied On 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.


Elangovan S

Replied On August 25, 2015 08:47 PM UTC

Thank you very much ! Solved my problem !

Elangovan S [Syncfusion]
Replied On August 26, 2015 03:58 AM UTC

Hi Sigrist,
Thanks for your update,
Please let us know if you have any more queries,
Elangovan 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