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 : Nov 16th 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:

Created:

Updated:

Platform:

Replies:

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

Hi,

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;
}


Raul
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..

Raul
Replied On April 23, 2007 07:10 PM UTC

hi,

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;
}
else
{
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...

Thanks,
Raul

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.

[c#]

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

Best regards,
Haneef

Raul
Replied On April 24, 2007 01:43 PM UTC

Thanks,

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

Raul
Replied On April 26, 2007 07:08 AM UTC

hi,

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?

WindowsApplication1470.zip

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.

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

;