The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hello there. My question is how to catch the "enter" key pressing while a cell is in TextBox mode? The point is that my grid is readonly by default, but sometimes I need to let the user to edit a cell, and get the content by pressing "enter" key.
LSLingaraj S Syncfusion Team August 26, 2009 11:45 AM UTC
Hi Erlan,
Thank you for your interest in Syncfusion products.
Please try using CurrentCellKeyDown event in GridControl to achieve this functionality.
Refer the code below: ######### C# Code this.gridControl1.CurrentCellKeyDown += new KeyEventHandler(gridControl1_CurrentCellKeyDown); void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e) { if (this.gridControl1.CurrentCell.Renderer.StyleInfo.CellType == "TextBox") { if (e.KeyCode == Keys.Enter) { // Catch the Enter key // perform the function } } } ######### VB Code AddHandler gridControl1.CurrentCellKeyDown, AddressOf gridControl1_CurrentCellKeyDown Private Sub gridControl1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) If Me.gridControl1.CurrentCell.Renderer.StyleInfo.CellType Is "TextBox" Then If e.KeyCode = Keys.Enter Then ' perform the function End If End If End Sub