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.
AD
Administrator
Syncfusion Team
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;
}
RA
Raul
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..
RA
Raul
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
HA
haneefm
Syncfusion Team
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
RA
Raul
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..
RA
Raul
April 26, 2007 07:08 AM UTC
hi,
The row is not highlighted nw, when I click on any cell DGBG.
AD
Administrator
Syncfusion Team
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