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.

GridGroupingControl: ColumnIndex

Thread ID:

Created:

Updated:

Platform:

Replies:

49067 Sep 11,2006 05:00 AM Sep 11,2006 08:26 AM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 11, 2006 05:00 AM

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!

Administrator [Syncfusion]
Replied On September 11, 2006 05:48 AM

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

Administrator [Syncfusion]
Replied On September 11, 2006 08:26 AM

Thanks!! It''s help!

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.

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.

;