Hi,
I've added a checkbox column in the ultragrid using grid designer, the problem is that the cell click event is behaving abnormally as i'am trying to toggle the checkbox state,and its not firing events related to cell like cell change , cell update events as desired, mean to say that some times checkbox changes state but no event get fired and sometimes all concerned event get fired .Do any body has any idea what should be the cause of the problem??
Where to call PerformAction(ExitEditMode)
I have a button outside the grid. On the click event of the button I update the grid values and call
PerformAction(ExitEditMode) and updategrid , this works file and the cell value is updated.
But i have a check-box column in the grid, on the click of the check-box , the cellchange event should fire. If it is not firing...where exactly do I need to call PerformAction(ExitEditMode)
I tried all the possible events but none of them works.
However I found an alternative . I used mouse down event
Private Sub SDPUltraGridTypes_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesSDPUltraGridTypes.MouseDown
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim objClickedElement As Infragistics.Win.UIElement = Me.SDPUltraGridTypes.DisplayLayout.UIElement.ElementFromPoint(e.Location)
If objClickedElement Is Nothing Then Return
Dim objCellElement As Infragistics.Win.UltraWinGrid.CellUIElement = CType(objClickedElement.GetAncestor(GetType(Infragistics.Win.UltraWinGrid.CellUIElement)), Infragistics.Win.UltraWinGrid.CellUIElement)
If objCellElement Is Nothing Then Return
Dim objCell As Infragistics.Win.UltraWinGrid.UltraGridCell = CType(objCellElement.GetContext(GetType(Infragistics.Win.UltraWinGrid.UltraGridCell)), Infragistics.Win.UltraWinGrid.UltraGridCell)
If objCell.Column.Key = "Set" Then
objCell.Row.Selected = True
objCell.Row.Activate()
If objCell.Value.Equals(True) Then
objCell.Value =
False
Else
True
End If
EndIf
End Sub
And Now Its working fine now,
Thanks
It sounds like you are using the Before/AfterCellUpdate events. These events only fire when the data is committed to the grid's underlying data source.
If you want to trap when a cell changes immediately, you should use the CellChange event. Note that you must use the Text property of the cell inside this event. You can't use Value, because Value doesn't get updated until you leave the cell.
The checkbox cell behaves like any other cell. The events are being fired only when the cell loses focus. I think this is not intuitive for a checkbox, so for any grid I have I use the cellclick event and I call PerformAction(ExitEditMode) if the column.StyleResolved is a checkbox.
Can you provide more detail as to specific scenarios that are giving you unexpected resutls? For instance, if you click in a particular specified location, what events are you expecting to happen and which ones are happening? Is the behavior consistent if you repeat it when clicking in the same location?
Is there a reason you're trying to toggle the checkbox state in the CellClick event of the grid? If the user clicks on the checkbox itself, it'll probably toggle the checkbox back to its original state.