AD
Administrator
Syncfusion Team
March 16, 2007 08:21 PM UTC
Hi Bill,
Is this the best way to handle this?
>>>>>
Yes. You can handle the TableControlCurrentCellChanged event of the grid and get the record and currentcell value using the below code snippet. Please let me know if this helps.
void gridGroupingControl1_TableControlCurrentCellChanged(object sender, GridTableControlEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = cc.Renderer.CurrentStyle as GridTableCellStyleInfo;
if (style.CellType == "CheckBox") //GridCellTypeName.CheckBox
{
Element el = style.TableCellIdentity.DisplayElement;
if (el.Kind == DisplayElementKind.Record)
{
GridRecordRow row = el as GridRecordRow;
if (row != null
&& row.ParentRecord != null)
{
Record rec = row.ParentRecord;
if ((bool)cc.Renderer.ControlValue)
{
//Perform True Section....
}
else
{
//Perform False Section....
}
}
}
}
}
Best regards,
Haneef
BL
Bill Langlais
March 17, 2007 03:44 AM UTC
I am using C++ and here is the code I wrote based on your code:
System::Void
Form1::srgCheckBoxClick(System::Object * sender, Syncfusion::Windows::Forms::Grid::Grouping::GridTableControlCellClickEventArgs * e)
{
bool Value;
GridCellClickEventArgs *Args = e->Inner;
GridCurrentCell *cc = e->TableControl->CurrentCell;
GridTableCellStyleInfo *style = dynamic_cast(cc->Renderer->CurrentStyle);
Element *el = style->TableCellIdentity->DisplayElement;
if (el->Kind == DisplayElementKind::Record) {
GridRecordRow *row = dynamic_cast(el);
if (row != NULL && row->ParentRecord != NULL) {
Record *rec = row->ParentRecord;
Value = Convert::ToBoolean(cc->Renderer->ControlValue);
}
}
}
row is always null when I execute and check or uncheck the check box.