This is a migrated thread and some comments may be shown as answers.

RadGridView

5 Answers 199 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kishor
Top achievements
Rank 1
Kishor asked on 02 Apr 2019, 04:38 AM

Hello

I am Working on a radgridView

My requirement is, i need to find which keyboard key is pressed in radGrideview CellEndEdit Event, Or

5 Answers, 1 is accepted

Sort by
0
Shanti 😎
Top achievements
Rank 2
Veteran
answered on 02 Apr 2019, 05:15 AM
hi kishor , am also looking for this solution
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Apr 2019, 09:45 AM
Hello,    

RadGridView manages user mouse and keyboard input over its rows by GridRowBehavior. Depending on the row type, RadGridView introduces different behaviors. Additional information about the row behavior and how to plug into it is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/gridview/rows/row-behaviors

However, if you need to detect keyboard events while the editor in RadGridView is activated, please refer to the following article: https://docs.telerik.com/devtools/winforms/controls/gridview/editors/handling-editors'-events

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Kishor
Top achievements
Rank 1
answered on 05 Apr 2019, 06:55 AM

Thank you for your response,

 

But My Actual requirement is , When i press Esc Key  in an editable RadGridview Cell , i need to show some message, but the problem is when i press Esc Key CellEditorInitialized event is not triggering and the Whole data in the Cell gets cleared and Cell goes to editmode false.

Is there any other way to detect the Esc key press.

 

Thanks in advance

 

 

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Apr 2019, 01:01 PM
Hello, Kishor,  

Pressing the Escape key will abort the edit operation and the changes will be rejected. It is desired behavior. You can plug into this behavior by creating a custom GridDataRowBehavior and overriding its ProcessEscapeKey method. You can find below a sample code snippet demonstrating how to show a message box after the default logic for processing the Escape key has already been executed. It is up to you whether the default logic will be performed and what exactly to performed according to the requirements that you have: 

public RadForm1()
{
    InitializeComponent();
     
    //register the custom row  behavior
    BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior;
    gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
    gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridDataRowBehavior());
}
 
public class CustomGridDataRowBehavior : GridDataRowBehavior
{
    protected override bool ProcessEscapeKey(KeyEventArgs keys)
    {
        //execute the basic logic
        bool result = base.ProcessEscapeKey(keys);
 
        RadMessageBox.Show("Escape key is pressed");
         
        return result;
    }
}

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Kishor
Top achievements
Rank 1
answered on 09 Apr 2019, 08:49 AM

Thank you for response,

Its Working Properly,

 

Tags
General Discussions
Asked by
Kishor
Top achievements
Rank 1
Answers by
Shanti 😎
Top achievements
Rank 2
Veteran
Dess | Tech Support Engineer, Principal
Telerik team
Kishor
Top achievements
Rank 1
Share this question
or