We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting the record that the cell belongs to when you get a GridTableControlCellClickEvent

Thread ID:

Created:

Updated:

Platform:

Replies:

58073 Mar 16,2007 07:43 PM UTC Mar 17,2007 03:44 AM UTC Windows Forms 2
loading
Tags: GridControl
Bill Langlais
Asked On March 16, 2007 07:43 PM UTC

Hi,

When a check box in a mult table nested GridGroupingControl changes state I want to take a action. I am trapping the GridTableControlCellClickEvent and need to know which record the event occured on. How can I find that out?

Is this the best way to handle this?

Administrator [Syncfusion]
Replied On 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

Bill Langlais
Replied On 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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;