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.

checkBox in Grid event handler

Thread ID:

Created:

Updated:

Platform:

Replies:

62032 Jun 6,2007 02:03 PM Jun 6,2007 04:25 PM Windows Forms 2
loading
Tags: GridControl
Chinedu
Asked On June 6, 2007 02:03 PM

I have checkboxes in a gridgroupingcontrol.

I hook into the TableControlCheckBoxClick event.

within this event, I capture the checked state of the checkbox and update the backend server with the new state, now if the server update fails, i want to revert the checkbox to its original checkstate before returning from this event, how do i go about this.

haneefm [Syncfusion]
Replied On June 6, 2007 02:33 PM

Hi Nedu,

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. If the update fails, then you can set cell value using the CurrentRecord.SetValue method in a grid. Below is a code snippet

void grid_TableControlCurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WriteLine("CheckBox cell( {0},{1})=> {2}", cc.RowIndex, cc.ColIndex, e.TableControl.GetTableViewStyleInfo(cc.RowIndex,cc.ColIndex).CellValue );
if( updateFails )
{
e.TableControl.Table.CurrentRecord.SetValue("CheckBox",false);
e.TableControl.Table.CurrentRecord.EndEdit();
}
}
}

Best regards,
Haneef

Chinedu
Replied On June 6, 2007 04:25 PM

Thanks Haneef,

How do I get the original checkstate of the checkbox, if the server update fails, I want to stop the change from going thru.

For instance, lets say the checkbox has a value of [True or Checked], a user clicks on it to change it to [False or UnChecked], I capture that click event and update the server with the new value, which would be [False or UnChecked] now and all is fine

However, if the update to the server fails, I want to keep the original value of the checkbox which is [True or Checked] in this case...

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.

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.

;