|
//Event triggering
gridGroupingControl1.TableControlPushButtonClick += GridGroupingControl1_TableControlPushButtonClick;
//Event customization
private void GridGroupingControl1_TableControlPushButtonClick(object sender,GridTableControlCellPushButtonClickEventArgs e)
{
//Suggestion 1
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.Column.Name == "Details")
{
// Button Detail
}
if (style.TableCellIdentity.Column.Name == "General")
{
// Button General
}
} |
|
//Event triggering
gridGroupingControl1.TableControlPushButtonClick += GridGroupingControl1_TableControlPushButtonClick;
//Event customization
private void GridGroupingControl1_TableControlPushButtonClick(object sender,GridTableControlCellPushButtonClickEventArgs e)
{
//Suggestion 2
GridRecordRow rec = this.gridGroupingControl1.Table.DisplayElements[e.Inner.RowIndex] asGridRecordRow;
DataRowView dr = rec.GetData() as DataRowView;
if (rec != null)
{
dr = rec.GetData() as DataRowView;
//To get the index of the column.
int details = gridGroupingControl1.TableDescriptor.VisibleColumns.IndexOf("Details");
//To get the actual index of the column in view
int detailsIndex = gridGroupingControl1.TableDescriptor.FieldToColIndex(details);
int general = gridGroupingControl1.TableDescriptor.VisibleColumns.IndexOf("General");
int generalIndex = gridGroupingControl1.TableDescriptor.FieldToColIndex(general);
if (e.Inner.ColIndex == detailsIndex)
{
// Button Detail
}
if (e.Inner.ColIndex == generalIndex)
{
// Button General
}
}
} |