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.
Unfortunately, activation email could not send to your email. Please try again.

The SfGrid.Rows.Count Solution

Thread ID:





120024 Aug 24,2015 02:58 PM Aug 25,2015 11:58 PM WPF 4
Tags: SfDataGrid
Asked On August 24, 2015 02:58 PM

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 03:29 PM

Hi SigRist.

The answer to Your quest in C#:

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



Elangovan S [Syncfusion]
Replied On August 25, 2015 10:03 AM

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 04:47 PM

Thank you very much ! Solved my problem !

Elangovan S [Syncfusion]
Replied On August 25, 2015 11:58 PM

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.

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.