I use your RadGridView with some GridViewMaskBoxColumn. The GridViewMaskBoxColumn is in masktype numeric with mask=f3.
I want to use the cells keypress event so if i press comma then the cursor jumps after the comma. But i cant find any keypress event for cells, any idea how could i make that work?
Private Sub GridView_CellEditorInitialized(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles Me.CellEditorInitialized
If Me.Columns(e.ColumnIndex).GetType.Name = "UniqeName" And TryCast(Me.Columns(e.ColumnIndex), WindowsControlLibrary1.MaskedBoxColumn).MaskType = Telerik.WinControls.UI.MaskType.Numeric Then
Dim editor As Telerik.WinControls.UI.RadMaskedEditBoxEditor = TryCast(Me.ActiveEditor, Telerik.WinControls.UI.RadMaskedEditBoxEditor)
Dim oszlop As Telerik.WinControls.UI.GridViewMaskBoxColumn = TryCast(Me.CurrentColumn, Telerik.WinControls.UI.GridViewMaskBoxColumn)
If editor IsNot Nothing And oszlop IsNot Nothing Then
Dim editorElement As Telerik.WinControls.UI.RadMaskedEditBoxItem = TryCast(editor.EditorElement, Telerik.WinControls.UI.RadMaskedEditBoxItem)
'editorElement.KeyPressEvent -= New KeyPressEventHandler(Me.CellaKeyPress)
'editorElement.KeyPressEvent += New KeyPressEventHandler(Me.CellaKeyPress)
End If
End If
End Sub
then we can use our cellKeyPress event
Private Sub CellaKeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
End Sub
0
Alexander
Telerik team
answered on 03 Jun 2010, 09:37 AM
Hello gabi,
You can also add handling of the "comma" key by creating a custom RadMaskedEditBoxEditor and use it instead of the default one. You can do it as it is shown below:
1. Specify that RadGridView will use the custom RadMaskedEditBoxEditor:
2. Implement the CustomRadMaskedEditBoxEditor, derived from RadMaskedEditBoxEditor and override BeginEdit() and EndEdit(). You can add an additional handler for the KeyDown event of the RadMaskedEditBoxEditor's RadMaskTextBox and implement the necessary logic in it:
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.