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

Are ActiveEditor.Keydown and ActiveEditor.KeyPress gone?

7 Answers 168 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Stargazer
Top achievements
Rank 2
Stargazer asked on 04 Jul 2009, 07:20 PM
Are these 2 events gone from the control ?

I can not use this anymore since I've upgraded to Q2... And I do not find anything about this in the release docs...

7 Answers, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 06 Jul 2009, 08:31 AM
Hi Stargazer,

We did a major revamp of RadGridView editors system. Now, all editors in grid inherit BaseGridEditor class, which is not a RadElement. You can access the underlying editor element by using the EditorElement property. Here is a sample:

void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) 
    RadTextBoxEditor editor = this.radGridView1.ActiveEditor as RadTextBoxEditor; 
    if (editor != null
    { 
        ((RadTextBoxItem)editor.EditorElement).KeyDown += new KeyEventHandler(Form1_KeyDown); 
    } 
 
void  radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e) 
    RadTextBoxEditor editor = this.radGridView1.ActiveEditor as RadTextBoxEditor; 
    if (editor != null
    { 
        ((RadTextBoxItem)editor.EditorElement).KeyDown -= new KeyEventHandler(Form1_KeyDown); 
    } 
 
void Form1_KeyDown(object sender, KeyEventArgs e) 
    //...     

I hope this helps. If you have more questions, don't hesitate to write us back.

Greetings,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Stargazer
Top achievements
Rank 2
answered on 06 Jul 2009, 09:57 AM
Hello, good morning!

I eventually was able to figured it out last Saturday, with the difference that I used RadTextBoxEditorElement, but had no access to the internet to post it.

Thanks!
0
Jack
Telerik team
answered on 06 Jul 2009, 11:22 AM
Hi, I am glad to hear that you have found a solution to this issue.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rawad
Top achievements
Rank 2
answered on 09 Jul 2014, 12:47 PM
Hello 

I tried to put the below code :

Private Sub radGridView1_CellBeginEdit(sender As Object, e As GridViewCellCancelEventArgs) Handles RadGridView1.CellBeginEdit
        Dim editor As RadTextBoxEditor = DirectCast(e.ActiveEditor, RadTextBoxEditor)
        If Not IsNothing(editor) Then
            Dim editorElement As RadTextBoxEditorElement = DirectCast(editor.EditorElement, RadTextBoxEditorElement)
            AddHandler editorElement.KeyPress, AddressOf KeyPresses
        End If
    End Sub

 Private Sub KeyPresses(sender As Object, e As KeyPressEventArgs)
        If Asc(e.KeyChar) <> 8 Then
            If ((Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57) And Asc(e.KeyChar) <> 46) Then
                e.Handled = True
            End If
        End If
    End Sub

but I'm able to insert alphanumeric for the first character, then it just let me enter an integer.
there's solution to just enter numeric for specific cells ?

Thanks 
0
Stefan
Telerik team
answered on 11 Jul 2014, 06:49 AM
Hello,

I have answered this question in the other forum thread you have posted: http://www.telerik.com/forums/validate-cell-datagrid#Y7UscmlzkUuoKs96Bm-cKA. Please avoid posting the same question numerous time. If you cannot find a suitable thread to address your question, you can always open a new one.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Mark
Top achievements
Rank 2
answered on 26 Jan 2015, 10:34 PM
I've run into the same depricated code examples online that don't work.  Basically I'm trying to get a radgrid to behave more like Excel with respect to the up/down keys.  The GridSpinEditor is preventing this I think.  Do you have a code example showing how to get the grid to move from cell to cell in the verticle direction (with the up/down arrow keys).  VB.net Winforms.
0
Stefan
Telerik team
answered on 27 Jan 2015, 11:19 AM
Hi Mark,

The grid moves up/down with the arrow keys, when there is no cell opened for edit. When such is opened, the editor will handle the keyboard (if needed), so the spinner or the date time picker can change their values. 

Please refer to the following post of mine, where I have provided an example how to prevent value change of the spin editor with the arrow keys, and move the row selection instead: http://www.telerik.com/forums/gridviewdecimalcolumn-up-down-key#yaJobaxmWEyB16Qaub1Zww
 
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Stargazer
Top achievements
Rank 2
Answers by
Jack
Telerik team
Stargazer
Top achievements
Rank 2
Rawad
Top achievements
Rank 2
Stefan
Telerik team
Mark
Top achievements
Rank 2
Share this question
or