private void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e) { GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex]; GridRecordRow r = style.TableCellIdentity.DisplayElement as GridRecordRow; string s = string.Format("val:{0} row:{1} col:{2}", r.ParentRecord.GetValue(style.TableCellIdentity.Column.MappingName), e.Inner.RowIndex, e.Inner.ColIndex); Console.WriteLine(s); }
private void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e) { if( e.Inner.MouseEventArgs.Button == MouseButtons.Right ) { GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex]; GridRecordRow r = style.TableCellIdentity.DisplayElement as GridRecordRow; if(r.ParentRecord != null) { barItem1.Text = "val:" + r.ParentRecord.GetValue(style.TableCellIdentity.Column.MappingName).ToString() + " col:" + e.Inner.ColIndex.ToString() + ", row:" + e.Inner.RowIndex.ToString(); popupMenu1.Show(gridGroupingControl1, new Point(e.Inner.MouseEventArgs.X, e.Inner.MouseEventArgs.Y)); } } }
private void button3_Click(object sender, System.EventArgs e)
{
Element el = this.gridGroupingControl1.Table.CurrentElement;
while (el is NestedTable)
el = ((NestedTable) el).ChildTable.ParentTable.CurrentElement;
if(el != null)
{
Record r = el as Record;
if (r == null)
r = el.ParentRecord;
if (r != null)
{
bool b = r.GetValue("boolCol") == DBNull.Value ? true : !(bool)r.GetValue("boolCol");
if(!r.IsEditing)
r.BeginEdit();
r.SetValue("boolCol", b);
r.EndEdit();
}
}
}
Stefan
>I need to do it outside of an event. I would like to set a cell of the selected child row to a specific value. If you refer to the sample i sent you i would need to set that value inside of the menu_click function.
>
>Thanks