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. Image for the cookie policy date
close icon

Programmatically selecting rows (version 2.1.0.9)

Hi,

I want to select the rows programmatically in a data bound grid (version 2.1.0.9). Please tell me how to do this. Basically i want to implement the row selector feature for my 1st column where user can select multiple rows.

The following code does not work!
m_ListingGrid1.Selections.Add(GridRangeInfo.Rows(rowIndex, colIndex))

Thanks,
Amiya

7 Replies

AD Administrator Syncfusion Team February 22, 2007 11:26 PM UTC

Hi Amiya,

To select rows in a grid, you need to turn on the AllowSelection property to other than None with AlphaBlend and set the AlphaBlendSelectionColor to new color. You can use the Model.Selection property to manage the selection in a grid. Here is a code snippet.

this.grid.AllowSelection = GridSelectionFlags.Any;
this.grid.AlphaBlendSelectionColor = Color.Red;

this.grid.Model.Selection.Add(GridRangeInfo.Rows(TopRowIndex,BottomRowIndex));

Best regards,
Haneef


AD Administrator Syncfusion Team February 23, 2007 03:47 PM UTC

Hi Haneef,

The solution doesn't work. I don't see row getting highlighted :(

Do I need to handle any other event?

Thanks,
Amiya


AD Administrator Syncfusion Team February 23, 2007 07:24 PM UTC

Hi Amiya,

Are you seeing this problem of rows not getting selected in the attached sample?
Here is a sample RowsSelection.zip

Regards,
Rajagopal


AD Administrator Syncfusion Team February 23, 2007 07:45 PM UTC

Haneef,
What is the equivalent code for hightlighting to use with a GGC?



>Hi Amiya,

Are you seeing this problem of rows not getting selected in the attached sample?
Here is a sample RowsSelection.zip

Regards,
Rajagopal


AD Administrator Syncfusion Team February 24, 2007 12:51 AM UTC

Hi Amiya,

Thank you for being patience.

The GridGroupingControl has two types of selection mode.

Type 1: Row based selection
This selection support can be turned on by setting the grid.tableOptions.AllowSelections to something other than None. This selection functionality raises events like the grid.TableModel.SelectionChanging/Changed.

Type 2: Record based selection
This selection support is turned on by setting the grid.TableOptions.AllowSelections to None and setting the grid.TableOptions.ListBoxSelectionMode to something other than None.

Please refer to the following KB article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

To programmatically select a row, you can add the respective row / record after enabling any of above selection types.

Type 1:
>>>>>>>
this.gridGroupingControl1.TableControl.Selections.Add(GridRangeInfo.Row(3));
>>>>>>>

Type 2:
>>>>>>>
this.gridGroupingControl1.Table.SelectedRecords.Add(record);
>>>>>>>

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan


AD Administrator Syncfusion Team March 2, 2007 05:30 PM UTC

Madhan, Rajagopal

The attached code doesn't build at all. I guess you are using different version of the grid. I am using 2.1.0.9.

BTW I am using VS 2005.

Thanks,
Amiya


AD Administrator Syncfusion Team March 2, 2007 05:53 PM UTC

Hi Amiya,

The version 2.1.0.9 of syncfusion is quite old and several newer versions with many additional features have been released since then. Our last release was Essential Studio 4.4, which is available for download. Our next release version 5.0 is scheduled to be launched this month.

The version that you are using currently is not compatible with VS 2005. If you plan to work with VS 2005 (.NET 2.0) then, Essential Studio version 4.x is recommended. This version is fully compatible and has been tested with .NET 2.0. This also supports VS 2002 and VS 2003 frameworks.

Please refer the below link to download the latest version
http://www.syncfusion.com/downloads/latestversion/default.aspx

Let us know if you need any further information.
Thanks for your interest in Syncfusion Products.

Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon