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. Image for the cookie policy date

very basic question

hi all.
i have a very basic question:
in my ggc, when the user click on a row i want to get the value of the first column.
what is the event and do i get the value?

3 Replies

AD Administrator Syncfusion Team February 8, 2007 06:17 PM UTC

Hi Shachar,

This can be achieved by handling the TableControlMouseDown event of th grid and get the value of the required column in record using the record.GetValue() method. Please refer to the attached sample for implementation and let me know if this helps.

private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X,e.Inner.Y));
if( style != null )
{
Element el = style.TableCellIdentity.DisplayElement;
if( el.Kind == DisplayElementKind.Record )
{
GridRecordRow rec = el as GridRecordRow;
if( rec != null
&& rec.ParentRecord != null )
MessageBox.Show("FirstColumn Value = " + rec.ParentRecord.GetValue("FirstColumnName") );
}
}
}

Sample : GGCGetRecord.zip

Best regards,
Haneef


SS Shachar Shimshon February 9, 2007 12:12 PM UTC

this grid is very complicated.
to get this simple task, you need to write so much code!
in the standard ms.datagridview it's so much easier!
why dont you have a simple click or select event that's being fired when the user click/select's a row, and then simply takes the row values?

>Hi Shachar,

This can be achieved by handling the TableControlMouseDown event of th grid and get the value of the required column in record using the record.GetValue() method. Please refer to the attached sample for implementation and let me know if this helps.

private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X,e.Inner.Y));
if( style != null )
{
Element el = style.TableCellIdentity.DisplayElement;
if( el.Kind == DisplayElementKind.Record )
{
GridRecordRow rec = el as GridRecordRow;
if( rec != null
&& rec.ParentRecord != null )
MessageBox.Show("FirstColumn Value = " + rec.ParentRecord.GetValue("FirstColumnName") );
}
}
}

Sample : GGCGetRecord.zip

Best regards,
Haneef


AD Administrator Syncfusion Team February 9, 2007 09:16 PM UTC

Hi Shachar,

Also you can use the TableCotrolCellClick event of the grid to get the first column value in a grid. In the GridGroupingControl, there are couple of Slection mechanisms. One is inherited from the GridControlBase and has no knowledge of any specific functionalities of the GridGroupingControl. The second selection support is a record based selection support that is specific to the GridGroupingControl. Please refer to the below KB article for more details.

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

Here is a attached sample that shows you how get the record information from TableControlCellClick event/SelectedRecordChanged event.
ModifiedGGCGetRecord.zip

Please post your queries in the grid forums section to get a quick response on GridControl.
Essential Grid Forum

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon