CheckBox event for spacebar
Hi -
i noticed that the CheckBoxClick event doesn't fire when the user changes it's value using the space bar even though the checkbox is sensitive to that keypress and knows what to do with it. What event gets fired letting me know the value has been set/changed?
Thanks,
Julie
i noticed that the CheckBoxClick event doesn't fire when the user changes it's value using the space bar even though the checkbox is sensitive to that keypress and knows what to do with it. What event gets fired letting me know the value has been set/changed?
Thanks,
Julie
SIGN IN To post a reply.
5 Replies
HA
haneefm
Syncfusion Team
April 23, 2007 11:20 PM UTC
Hi Julie,
This is by design. If you want to get the CheckBoxState changes when pressing the SPACE bar in a grid cell then hanlde the CurrentCellChanged event for check box cell. Here is a code snippet to shiw this.
private void gridDataBoundGrid1_CurrentCellChanged(object sender, EventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
GridCurrentCell cc = grid.CurrentCell;
if( grid.Model[cc.RowIndex, cc.ColIndex].CellType == "CheckBox" )
Console.WriteLine("CheckBox has been clicked!");
}
Best regards,
Haneef
This is by design. If you want to get the CheckBoxState changes when pressing the SPACE bar in a grid cell then hanlde the CurrentCellChanged event for check box cell. Here is a code snippet to shiw this.
private void gridDataBoundGrid1_CurrentCellChanged(object sender, EventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
GridCurrentCell cc = grid.CurrentCell;
if( grid.Model[cc.RowIndex, cc.ColIndex].CellType == "CheckBox" )
Console.WriteLine("CheckBox has been clicked!");
}
Best regards,
Haneef
RA
Rajagopal
Syncfusion Team
April 23, 2007 11:22 PM UTC
Hi Julie,
The CheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox. You can catch the CurrentCellChanged event for detecting any changes made to the checkbox cell.
Regards,
Rajagopal
The CheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox. You can catch the CurrentCellChanged event for detecting any changes made to the checkbox cell.
void gridDataBoundGrid1_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WriteLine("CheckBox cell({0},{1})", cc.RowIndex, cc.ColIndex);
}
}
Regards,
Rajagopal
JL
Julie Levy
April 23, 2007 11:29 PM UTC
Hi -
thanks for your response. I have one question: how does the CurrentCellEditingComplete work with CurrentCellChanged? Will CurrentCellChanged fire on every key press? I used CurrentCellEditingComplete to track changes to regular textbox cells.
Thanks,
Julie
thanks for your response. I have one question: how does the CurrentCellEditingComplete work with CurrentCellChanged? Will CurrentCellChanged fire on every key press? I used CurrentCellEditingComplete to track changes to regular textbox cells.
Thanks,
Julie
HA
haneefm
Syncfusion Team
April 24, 2007 03:45 PM UTC
Hi Julie,
How does the CurrentCellEditingComplete work with CurrentCellChanged?
>>>>
The CurrentCellEditingComplete event is occured when the grid completes editing mode for the active current cell. But the CheckBox cell is a special case as the changes are committed with each click and do not wait for the user to leave the cell for the changes to be committed. So, it is handled differently. So, if you want to catch each change in a CheckBox, you have to use CurrentCellChanged. You can only execute your code for CheckBox cells by testing the CellType of the currentcell. In the checkbox cell, The CurrentCellEditingComplete event doesn't occur.
Will CurrentCellChanged fire on every key press?
>>>>>
No, The CurrentCellChanged event is occured when the user changed contents of the current cell.
Best regards,
Haneef
How does the CurrentCellEditingComplete work with CurrentCellChanged?
>>>>
The CurrentCellEditingComplete event is occured when the grid completes editing mode for the active current cell. But the CheckBox cell is a special case as the changes are committed with each click and do not wait for the user to leave the cell for the changes to be committed. So, it is handled differently. So, if you want to catch each change in a CheckBox, you have to use CurrentCellChanged. You can only execute your code for CheckBox cells by testing the CellType of the currentcell. In the checkbox cell, The CurrentCellEditingComplete event doesn't occur.
Will CurrentCellChanged fire on every key press?
>>>>>
No, The CurrentCellChanged event is occured when the user changed contents of the current cell.
Best regards,
Haneef
JL
Julie Levy
April 25, 2007 02:47 AM UTC
thanks for the explanation Haneef.
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
JL Julie Levy
- Apr 23, 2007 11:06 PM UTC
- Apr 25, 2007 02:47 AM UTC