GridGroupingControl: ColumnIndex

hi,

i would like to get the cell value when i click on a certain row. i do as follow:

void TableControl_MouseDown(object sender, MouseEventArgs e)
{
int rowIndex, colIndex
Point pt = new Point(e.X, e.Y);
dgSent.TableControl.PointToRowCol(pt, out rowIndex, out colIndex);
dgSent.TableControl.Model[rowIndex,1].Text.Trim()
}

As the code above, i want to get the First Column value of the row. I failed to get it when there is GroupColumn.

Please help! Thanks!

2 Replies

AD Administrator Syncfusion Team September 11, 2006 09:48 AM UTC

Hi Lim,

Try this code snippet to get the first column value in a record.

private void TableControl_MouseDown(object sender, MouseEventArgs e)
{
GridTableControl tableControl = sender as GridTableControl;
Point pt = new Point(e.X, e.Y);

int row, col;
if(tableControl.PointToRowCol(pt, out row, out col))
{
GridTableCellStyleInfo style = tableControl.PointToTableCellStyle(pt);
if( style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
GridRecordRow rec = style.TableCellIdentity.DisplayElement as GridRecordRow;
string firstColumnName = style.TableCellIdentity.Table.TableDescriptor.Columns[0].Name;

Console.WriteLine("First Column Value: " + rec.ParentRecord.GetValue(firstColumnName).ToString() );
}
}
}

Let me know if this helps.
Best Regards,
Haneef


AD Administrator Syncfusion Team September 11, 2006 12:26 PM UTC

Thanks!! It''s help!

Loader.
Up arrow icon