this.gridGroupingControl1.TableControlCellButtonClicked += gridGroupingControl1_TableControlCellButtonClicked;
void gridGroupingControl1_TableControlCellButtonClicked(object sender,GridTableControlCellButtonClickedEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
MessageBox.Show("Push button cell value: " + style.CellValue.ToString());
} |
this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity == null || e.TableCellIdentity.Column == null)
return;
if (e.TableCellIdentity.Column.Name == "Country")
{
e.Style.Description = e.Style.CellValue.ToString();
e.Style.HorizontalAlignment = GridHorizontalAlignment.Center;
}
} |
void gridGroupingControl1_TableControlCellButtonClicked(object sender,GridTableControlCellButtonClickedEventArgs e)
{
MessageBox.Show("Push button cell value: " + e.Inner.Button.Text);
} |
Mohanraj,
This worked perfectly! Thanks for the help!
this.gridGroupingControl1.TableControlCellButtonClicked += gridGroupingControl1_TableControlCellButtonClicked;
void gridGroupingControl1_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e)
{
//To get the button text
string text = e.Inner.Button.Text;
//To iterate the rows
for (int i = 0; i < this.gridGroupingControl1.Table.Records.Count; i++)
{
var record = this.gridGroupingControl1.Table.Records[i];
//To iterate the columns
foreach (var column in this.gridGroupingControl1.TableDescriptor.Columns)
{
//To get the cellvalue
string cellvalue = record.GetValue(column.Name).ToString();
}
}
} |