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

Event for Checkbox click.

Thread ID:

Created:

Updated:

Platform:

Replies:

64811 Jul 24,2007 10:28 AM UTC Jul 24,2007 10:27 PM UTC Windows Forms 3
loading
Tags: GridControl
Amol Choudhari
Asked On July 24, 2007 10:28 AM UTC

Hi,

I am using syncfusion grid grouping control. I want to capture check box event control so that I can modify the current record's property depending on check box's boolen value.

For Eg. I have check boxes in one column for each row.
If I check one check box for particular row, then I want to modify the current record's property.
Here I also want to get current record's data.

Please help.

Thanks,
Amol Choudhari

haneefm [Syncfusion]
Replied On July 24, 2007 02:43 PM UTC

Hi Amol,

The TableControlCheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox cell. You can catch the TableControlCurrentCellChanged event for detecting any changes made to the checkbox cell. Below is a code snippet:

void gridTableControlCurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WrtieLine( e.TableControl.Table.CurrentRecord.Info);
DataRowview rv = e.TableControl.Table.CurrentRecord.GetData() as DataRowview;
}
}

gridGroupingControl1.TableControlCheckBoxClick += new Grouping.GridTableControlCellClickEventHandler(gridTableControlCheckBoxClick);

void gridTableControlCheckBoxClick(object sender, GridTableControlCellClickEventArgs e)
{
Console.WrtieLine( e.TableControl.Table.CurrentRecord.Info);
DataRowview rv = e.TableControl.Table.CurrentRecord.GetData() as DataRowview;
}

Best regards,
Haneef

Amol Choudhari
Replied On July 24, 2007 03:42 PM UTC

Hi Haneef,

In my case TableControlCurrentCellChanged event is not fired while clicking on check box on particular row. So this event is not useful I hope...

and TableControlCheckBoxClick event is fired in my grid, while clicking on check box but
in this case I am not getting CURRENTRECORD.
at (e.TableControl.Table.CurrentRecord.GetData() - here CurrentRecord is null )
So not able to modify the property of selected row's data.

Please suggest any other way.

Thanks,
Amol Choudhari

>Hi Amol,

The TableControlCheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox cell. You can catch the TableControlCurrentCellChanged event for detecting any changes made to the checkbox cell. Below is a code snippet:

void gridTableControlCurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WrtieLine( e.TableControl.Table.CurrentRecord.Info);
DataRowview rv = e.TableControl.Table.CurrentRecord.GetData() as DataRowview;
}
}

gridGroupingControl1.TableControlCheckBoxClick += new Grouping.GridTableControlCellClickEventHandler(gridTableControlCheckBoxClick);

void gridTableControlCheckBoxClick(object sender, GridTableControlCellClickEventArgs e)
{
Console.WrtieLine( e.TableControl.Table.CurrentRecord.Info);
DataRowview rv = e.TableControl.Table.CurrentRecord.GetData() as DataRowview;
}

Best regards,
Haneef

haneefm [Syncfusion]
Replied On July 24, 2007 10:27 PM UTC

Hi Amol,

You can try these code :

private void gridGroupingControl1_TableControlCheckBoxClick(object sender, GridTableControlCellClickEventArgs e)
{
int RowIndex = e.Inner.RowIndex;
int ColIndex = e.Inner.ColIndex;
if( RowIndex > -1 && ColIndex > -1)
{
GridTableCellStyleInfo Style = e.TableControl.GetTableViewStyleInfo(RowIndex, ColIndex);
if( Style != null)
{
Element el = Style.TableCellIdentity.DisplayElement;
if (el != null)
{
Record rec = el.GetRecord();
DataRowView dv = rec.GetData() as DataRowView;
}
}
}
}

Best regards,
Haneef

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

;