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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





59778 Apr 21,2007 01:38 PM UTC Apr 26,2007 12:25 PM UTC WinForms 7
Tags: GridControl
Asked On April 21, 2007 01:38 PM UTC


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 09:30 PM UTC

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 06:42 PM UTC

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

Replied On April 23, 2007 07:10 PM UTC


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 07:18 PM UTC

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 01:43 PM UTC


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

Replied On April 26, 2007 07:08 AM UTC


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

Administrator [Syncfusion]
Replied On April 26, 2007 12:25 PM UTC

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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