4 Answers, 1 is accepted
0
Hello Kyle,
Thank you for writing.
You should create custom grid navigator and override the SelectCore method:
You can change the default navigator like this:
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Thank you for writing.
You should create custom grid navigator and override the SelectCore method:
class
MyBaseGridNavigator : BaseGridNavigator
{
protected
override
bool
SelectCore(GridViewRowInfo row, GridViewColumn column)
{
this
.GridViewElement.EndEdit();
return
base
.SelectCore(row, column);
}
}
You can change the default navigator like this:
radGridView1.GridViewElement.Navigator =
new
MyBaseGridNavigator();
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Kyle
Top achievements
Rank 1
answered on 17 Jun 2016, 03:21 PM
Thanks for your response.
Your code worked when I'm editing a cell and use the arrow keys, but when I edit a cell and hit the enter key it moves to the cell below and puts it in edit mode.
Any ideas?
0
Accepted
Hi Kyle,
Thank you for writing back.
To handle the Enter key you need to create a custom row behavior and override the ProcessEnterKey method. The following snippet shows this along with how you can register the new behavior:
I hope this will be useful.
Regards,
Dimitar
Telerik
Thank you for writing back.
To handle the Enter key you need to create a custom row behavior and override the ProcessEnterKey method. The following snippet shows this along with how you can register the new behavior:
public
Form1()
{
InitializeComponent();
BaseGridBehavior gridBehavior = radGridView1.GridBehavior
as
BaseGridBehavior;
gridBehavior.UnregisterBehavior(
typeof
(GridViewDataRowInfo));
gridBehavior.RegisterBehavior(
typeof
(GridViewDataRowInfo),
new
CustomGridRowBehavior());
}
class
CustomGridRowBehavior : GridDataRowBehavior
{
protected
override
bool
ProcessEnterKey(KeyEventArgs keys)
{
var result =
base
.ProcessEnterKey(keys);
this
.GridControl.EndEdit();
return
result;
}
}
I hope this will be useful.
Regards,
Dimitar
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Kyle
Top achievements
Rank 1
answered on 20 Jun 2016, 02:51 PM
Thank you. That did the trick.