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.

Get selected rows/cells in griddataboundgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

81238 May 18,2009 08:38 AM May 23,2009 02:47 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 18, 2009 08:38 AM


Hi,

I am using GridDataBoundGrid and need to get the contents of the selected rows. I am looking something like the DataGridViewSelectedRowCollection in windows forms.

I am using the MultiExtended selection mode as below:

_aggregateGrid.ListBoxSelectionMode = SelectionMode.MultiExtended; [so that whole rows are selected instead of individual cells]

If the user selects 2 rows, how do I get the contents of the selected rows(I need to get the cell values as well). Also I need to find out which cell was selected first.

I tried using :

GridRangeInfoList rangeList = new GridRangeInfoList();
_aggregateGrid.Selections.GetSelectedRanges(out rangeList, true);
if (rangeList.Count > 0)
{
foreach (GridRangeInfo range in rangeList)
{
GridStyleInfo[] info = _aggregateGrid.Model.GetCellsInfo(range);

but this returns info as null.

Thanks,
Tanmay

Lingaraj S [Syncfusion]
Replied On May 23, 2009 02:47 AM

Hi Tanmay,

Thank you for your interest in Syncfusion product.

If you want to get the selected cells in GridDataBoundControl. Please try using GridRangeInfo properties to acheive this behaviour.

Please refer the code below:

GridRangeInfoList list;
if(this.gridDataBoundGrid1.Selections.GetSelectedRanges(out list, true))
{
foreach(GridRangeInfo range in list)
{
List range = new List();
for(int i = range.Top; i <= range.Bottom; i++)
for(int j= range.Left; j <= range.Right; j++)
range.Add(GridRangeInfo.Cell(i,j));
}
}


Please let me know if it helps.

Regards,
Lingaraj S.

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.

;