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

Getting selected Rows counts

Thread ID:

Created:

Updated:

Platform:

Replies:

41156 Feb 23,2006 02:47 PM UTC Aug 3,2017 09:26 AM UTC WinForms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 23, 2006 02:47 PM UTC

Hi, How do i get the selected Rows count for grid databound grid? i''ve tried "gridatabound.selections.count", but it will only return 1 no matter how many rows i selected. Thanks in advance :)

stanleyj [Syncfusion]
Replied On February 23, 2006 03:15 PM UTC

Hi Wye Jin, Try this: this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.Height Best regards, Stanley

Administrator [Syncfusion]
Replied On February 24, 2006 01:54 AM UTC

Hi stanley, Thanks for saving my day again. It works perfectly :)

Unknown
Replied On August 2, 2017 02:33 PM UTC

A little late for a response, but for future reference if you allow multiple range selection, you'll need to loop through all Ranges, and sum the Height of each.

If you select rows 1-10 and then 15-17, your count will only be 3 with ActiveRange.Height.


Mohanraj Gunasekaran [Syncfusion]
Replied On August 3, 2017 09:26 AM UTC

Hi Chris, 

Thanks for your update. 

Yes, you were right. if you want the selection count for multiple range selection, you can iterate the ranges and calculate the height for all Ranges. Here, I have shared the code part to calculate the selection count. 

Code example 

int selectionCount = 0; 
foreach (GridRangeInfo range in this.gridDataBoundGrid1.Selections.Ranges) 
{ 
    selectionCount += range.Height; 
} 
 

Regards, 
Mohanraj G 


CONFIRMATION

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.

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

;