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.

Hw do I select a row in DGBG instead of focussing on a cell

Thread ID:





59778 Apr 21,2007 09:38 AM Apr 26,2007 08:25 AM Windows Forms 7
Tags: GridControl
Asked On April 21, 2007 09:38 AM


I am interested in knowing Hw do I select a row in DGBG instead of focussing on a cell?
I dont want the cusror on a cell, when a user clicks on a cell I want the entire row to highlight.

Administrator [Syncfusion]
Replied On April 22, 2007 05:30 PM

You can set

this.gridDataBoundGrid1.ListBoxSelectionMode = SelectionMode.One;

to select the row when you click on a cell.

If you do not want to edit any of the cells, you can also handle this event.

gridDataBoundGrid1.CurrentCellActivating += new GridCurrentCellActivatingEventHandler(gridDataBoundGrid1_CurrentCellActivating);

void gridDataBoundGrid1_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e)
e.ColIndex = 0;

Replied On April 23, 2007 02:42 PM

thanks for yr reply, the focus on cell goes thats perfect..however I would like the row to highlight..

Replied On April 23, 2007 03:10 PM


i would like to fetch the selected rows from DGBG. I am appending the code which worked earlier before writing this code :
foreach (GridRangeInfo info in this.dgrdUserSetup.Model.SelectedRanges)
for (int i = info.Top; i <= info.Bottom; i++)
if (i == info.Top)
sel = dgrdUserSetup[i, 1].Text;
row = info.Top;
sel = sel + "," + dgrdUserSetup[i, 1].Text;
multUsers = true;

my requirement is to get a list of all rows selected or a single row and when i click on any cell of a grid..I would also want it to highlight...


haneefm [Syncfusion]
Replied On April 23, 2007 03:18 PM

Hi Rahul,

Use GetSelectedRows method from the GridModelSelections to get the selected rows in the grid. It returns the GridRangeInfoList with row ranges. It takes two parameters.

bRangeRowsOnly -True if only selected rows should be returned; False if you want to treat single range cell selections as full row selections.
considerCurrentCell - True if current cell should be returned as selected range if there are no other selected ranges.


foreach (GridRangeInfo r in this.gridDataBoundGrid1.Model.Selections.GetSelectedRows(true, true))
Console.WrtieLine( "RangeInfo:" + r.Info);

Best regards,

Replied On April 24, 2007 09:43 AM


Its working perfectly..however the row is not getting highlighted when I click on any cell of grid..

Replied On April 26, 2007 03:08 AM


The row is not highlighted nw, when I click on any cell DGBG.

Administrator [Syncfusion]
Replied On April 26, 2007 08:25 AM

This line of code should make the whle row be selected when you click a single cell.

grid.ListBoxSelectionMode = SelectionMode.One;

The row is highlighted using an alpha-blend selection. Here is a sample. Is this not what you want?



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.