i want to use the radvirtualgrid to add a new row/record to a database but instead of using Tab button to switch between column i prefer to use the enter key.
is that possible, if yes can you give me a sample please ?
Thanks in advance
2 Answers, 1 is accepted
0
Nadya | Tech Support Engineer
Telerik team
answered on 23 Jun 2021, 04:32 PM
Hello, Atfat,
If I understand you correctly, you want to move the selection to the next cell when pressing the Enter key instead of the Tab key. To achieve this behavior you can handle the PreviewKeyDown event as follows:
I hope this helps. If you have other questions do not hesitate to ask.
Regards,
Nadya
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hello Nadya
it does not work
please can you send me a sample to illustrate how to use radvirtualgrid to add a new row with an enter key to move to next column in vb.net
thank you
Please refer to the following sample in VB which result is illustrated in the provided gif file:
PublicSubNew()
InitializeComponent()
Me.radVirtualGrid1.RowCount = 30Me.radVirtualGrid1.ColumnCount = 6AddHandlerMe.radVirtualGrid1.CellValueNeeded, AddressOf radVirtualGrid1_CellValueNeeded
AddHandlerMe.radVirtualGrid1.PreviewKeyDown, AddressOf RadVirtualGrid1_PreviewKeyDown
EndSubPrivateSub RadVirtualGrid1_PreviewKeyDown(ByVal sender AsObject, ByVal e As PreviewKeyDownEventArgs)
If e.KeyCode = Keys.Enter ThenMe.radVirtualGrid1.VirtualGridElement.MoveCurrentRight(True)
EndIfEndSubPrivateSub radVirtualGrid1_CellValueNeeded(ByVal sender AsObject, ByVal e As VirtualGridCellValueNeededEventArgs)
If e.RowIndex = -1Then
e.Value = "Col" & e.ColumnIndex
Else
e.Value = "Name" & e.RowIndex + e.ColumnIndex
e.FieldName = "Col" & e.ColumnIndex
EndIfEndSub
Is this the result that you want to obtain when pressing the Enter key in the virtual grid? If you have more custom requirements, it would be greatly appreciated if you can provide more information about the desired behavior.
I hope this helps. Please let me know if I can assist you further.