I have a piece of code that refreshes the grid when the user hits ctrl+r, but this has stopped working between 2011 Q3 SP1 and 2012 Q1 SP1. The event fires when I press R or other keys alone, but holding ctrl while pressing does not work. The shortcuts for cut, paste, copy work with the ctrl button held.
6 Answers, 1 is accepted
0
Hi Daniel,
Thank you for writing.
One way to handle this key combination is to handle the PreviewKeyDown event of RadGridView:
Please give this approach a try and let me know how this works for you.
Regards,
Stefan
the Telerik team
Thank you for writing.
One way to handle this key combination is to handle the PreviewKeyDown event of RadGridView:
void
radGridView1_PreviewKeyDown(
object
sender, PreviewKeyDownEventArgs e)
{
if
(e.Modifiers == Keys.Control && e.KeyCode == Keys.R)
{
//your logic here
}
}
Please give this approach a try and let me know how this works for you.
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Dan
Top achievements
Rank 1
answered on 17 Apr 2012, 01:36 PM
Thanks for your reply. I was told by another member of the support team that implementing a custom behavior that overrides ProcessKeyDown would also work, and I have implemented my solution using that.
public
class
KeyDownBehavior : BaseGridBehavior
{
public
override
bool
ProcessKeyDown(KeyEventArgs keys)
{
if
(keys.Control && keys.KeyCode == Keys.R)
{
//do something here
}
return
base
.ProcessKeyDown(keys);
}
}
0
Hi Daniel,
That is absolutely correct. Feel free to use the custom behavior approach.
We kindly ask you to use just one support channel to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover, threads are handled according to the license type and the time of posting, so if it is an urgent problem, we suggest opening a support ticket, which would be handled before a forum thread.
Thank you for your understanding.
Regards,
Stefan
the Telerik team
That is absolutely correct. Feel free to use the custom behavior approach.
We kindly ask you to use just one support channel to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover, threads are handled according to the license type and the time of posting, so if it is an urgent problem, we suggest opening a support ticket, which would be handled before a forum thread.
Thank you for your understanding.
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Joe Sugden
Top achievements
Rank 1
answered on 12 Jun 2012, 09:31 PM
This is not working in the new Release 2012 Q2 either.
We initially had in as described in :
http://www.telerik.com/support/kb/winforms/gridview/implementing-copy-paste-to-excel-functionality-in-radgridview-for-winforms.aspx
but now KeyDown Event doesn't respond when holding CtrlThe PreviewKeyDown does not do us any good because after we copy to clipboard in there, the grid autmatically overwrites it with it's own copy functionality.
We initially had in as described in :
http://www.telerik.com/support/kb/winforms/gridview/implementing-copy-paste-to-excel-functionality-in-radgridview-for-winforms.aspx
but now KeyDown Event doesn't respond when holding Ctrl
The PreviewKeyDown does not do us any good because after we copy to clipboard in there, the grid autmatically overwrites it with it's own copy functionality.
Now what???
0
Joe Sugden
Top achievements
Rank 1
answered on 13 Jun 2012, 01:50 PM
Well inheriting from BaseGridBehavior works, but still there is a bug with grid key events...
0
Hello Daniel,
In regards to the events, the KeyDown/PreviewKeyDown event does expose some of the pressed keys, however, if you want to have a full control, you should use the GridBehavior.
In regards to the embedded copy/paste functionality, you can disable it by using the following code:
I hope this helps.
All the best,
Stefan
the Telerik team
In regards to the events, the KeyDown/PreviewKeyDown event does expose some of the pressed keys, however, if you want to have a full control, you should use the GridBehavior.
In regards to the embedded copy/paste functionality, you can disable it by using the following code:
radGridView1.ClipboardCopyMode = Telerik.WinControls.UI.GridViewClipboardCopyMode.Disable;
I hope this helps.
All the best,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>