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.

Getting selected Rows counts

Thread ID:

Created:

Updated:

Platform:

Replies:

41156 Feb 23,2006 09:47 AM Aug 3,2017 05:26 AM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 23, 2006 09:47 AM

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 10:15 AM

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

Administrator [Syncfusion]
Replied On February 23, 2006 08:54 PM

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

Unknown
Replied On August 2, 2017 10:33 AM

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 05:26 AM

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.

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.

;