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.
Syncfusion Feedback

Get selected rows

Thread ID:

Created:

Updated:

Platform:

Replies:

87931 Jul 13,2009 10:30 AM UTC Jul 15,2009 10:09 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
Mr. Sascha Wald
Asked On July 13, 2009 10:30 AM UTC

Hi,

we have Syncfusion 6.3.1.8. I know, not the latest but I wonder if it is my way of thinking or a bug in that version:
The user can select rows in a griddataboundgrid. If more than one row is selected, a special button has to be disabled. The problem: The user selects via mouse: code runs ok, button is disabled. User selects via keyboard: code allways returns that only one row is selected!

Dim gridList As Syncfusion.Windows.Forms.Grid.GridRangeInfoList = New Syncfusion.Windows.Forms.Grid.GridRangeInfoList()

m_ReviewTaskUserGridDataBoundGrid.Selections().GetSelectedRanges(gridList, True)

I can see the selected part in the item "gridList". Always shows only the newly selected row.
-> is there a fast way to find out if there is more than one row selected?

regards
sascha



Jisha Joy [Syncfusion]
Replied On July 14, 2009 09:54 AM UTC

Hi Sascha,

Thank you for posting query to us.

For getting the seleted rows count, you will have to iterate through the selections and add up the rows. See the code:

private void button1_Click(object sender, EventArgs e)
{

int selectedRows = 0;

foreach (GridRangeInfo range in this.gridDataBoundGrid1.Selections.GetSelectedRows(true, false))
{

selectedRows += range.Bottom - range.Top + 1;

}

Console.WriteLine(selectedRows.ToString());


}

Let me know if this helps.

Regards,
Jisha

Mr. Sascha Wald
Replied On July 14, 2009 11:12 AM UTC

Sorry, doesn't work here.
When I select a row and expand the selection with the keyboard, it returns always "1" (the newly added selection and not the whole selection-range).

regards sascha

Jisha Joy [Syncfusion]
Replied On July 15, 2009 10:09 AM UTC

Hi Sascha,

Thank you for your update.

Instead of using the GetSelectedRows, try using GetSelectedRanges method and let me know if this helps.

See the code:
private void button1_Click(object sender, EventArgs e)
{
int selectedRows = 0;

GridRangeInfoList list= new GridRangeInfoList();
this.gridDataBoundGrid1.Selections.GetSelectedRanges(out list, true);
foreach (GridRangeInfo range in list) {

selectedRows += range.Bottom - range.Top + 1;

}

Console.WriteLine(selectedRows.ToString());


}

Regards,
Jisha

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

;