Hi Anne,
Thanks for contacting Syncfusion Support.
If you are using the QueryCellInfo event to get the record value, it can be achieved by getting the display element of the current record. The event argument of the QueryCellInfo
has the style object ”e”, we can get the display element by using the e.TableCellIndentity.DisplayElement . Please refer to the following code example,
Code Example:
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.RowIndex == 20)
{
Element el = e.TableCellIdentity.DisplayElement as Element;
if (el != null && e.TableCellIdentity.TableCellType == Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.RecordFieldCell)
{
string fieldValue = el.ParentRecord.GetValue("City").ToString();
}
}
}
Suggestion 2:
this.gridGroupingControl1.TableControlCellMouseDown += gridGroupingControl1_TableControlCellMouseDown;
//Get the record value using the row index
void gridGroupingControl1_TableControlCellMouseDown(object sender, GridTableControlCellMouseEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
Element el = style.TableCellIdentity.DisplayElement;
if(el != null && el.ParentRecord !=null)
{
Record record = el.ParentRecord as Record;
MessageBox.Show(record.GetValue("City").ToString());
}
}
Regards,
Adhi