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.

programatically selceting grid.

Thread ID:

Created:

Updated:

Platform:

Replies:

61602 May 29,2007 05:44 PM May 30,2007 06:27 AM Windows Forms 2
loading
Tags: GridControl
dinesh upreti
Asked On May 29, 2007 05:44 PM

hi,

I am using griddatabound control.
I have following two queries:

1) How to programatically select a particular cell say cell(10,10) in grid.
2) When I select a cell in the grid using mouse, the cell click event gets fired. How do i get the cell selected event when i navigate through cells using tab key or up/down arrow keys.


haneefm [Syncfusion]
Replied On May 29, 2007 05:56 PM

Hi Dinesh,

1) How to programatically select a particular cell say cell(10,10) in grid?
>>>>>>>>>>>>>>
You can use the Model.Selections property to manages selected ranges in the grid. It allows you to add and remove selections, determines selection state of a specific cell. Here is a code to select (2,2) cell in a grid.

//highlight the cell
this.grid1.Model.Selections.Add(GridRangeInfo.Cell(2,2));
//highlight the row
this.grid1.Model.Selections.Add(GridRangeInfo.Row(RowIndex));
//highlight the cell
this.grid1.Model.Selections.Add(GridRangeInfo.Cell(RowIndex,ColIndex);
//highlight the cell
this.grid1.Model.Selections.Add(GridRangeInfo.Col(CoIIndex));

2) When I select a cell in the grid using mouse, the cell click event gets fired. How do i get the cell selected event when i navigate through cells using tab key or up/down arrow keys.
>>>>>>>>>>>>>>
You can try handle the Model.SelectionChanging event to detect the cell selection in a grid. Please try this and let me know if this helps.

Best regards,
Haneef

dinesh upreti
Replied On May 30, 2007 06:27 AM

hi,

this.grid1.Model.Selections.Add(GridRangeInfo.Cell(2,2));
does makes the cell appear as selected but it doesnot sets the CurrentCell property. I want to programatically set this CurrentCell property.

Thanks

dinesh

>Hi Dinesh,

1) How to programatically select a particular cell say cell(10,10) in grid?
>>>>>>>>>>>>>>
You can use the Model.Selections property to manages selected ranges in the grid. It allows you to add and remove selections, determines selection state of a specific cell. Here is a code to select (2,2) cell in a grid.

//highlight the cell
this.grid1.Model.Selections.Add(GridRangeInfo.Cell(2,2));
//highlight the row
this.grid1.Model.Selections.Add(GridRangeInfo.Row(RowIndex));
//highlight the cell
this.grid1.Model.Selections.Add(GridRangeInfo.Cell(RowIndex,ColIndex);
//highlight the cell
this.grid1.Model.Selections.Add(GridRangeInfo.Col(CoIIndex));

2) When I select a cell in the grid using mouse, the cell click event gets fired. How do i get the cell selected event when i navigate through cells using tab key or up/down arrow keys.
>>>>>>>>>>>>>>
You can try handle the Model.SelectionChanging event to detect the cell selection in a grid. Please try this and let me know if this helps.

Best regards,
Haneef

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.

;