Are ActiveEditor.Keydown and ActiveEditor.KeyPress gone?

8 posts, 1 answers
  1. Stargazer
    Stargazer avatar
    73 posts
    Member since:
    Jan 2007

    Posted 04 Jul 2009 Link to this post

    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...
  2. Answer
    Jack
    Admin
    Jack avatar
    2335 posts

    Posted 06 Jul 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stargazer
    Stargazer avatar
    73 posts
    Member since:
    Jan 2007

    Posted 06 Jul 2009 Link to this post

    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!
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 06 Jul 2009 Link to this post

    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.
  6. Rawad
    Rawad avatar
    23 posts
    Member since:
    Jan 2012

    Posted 09 Jul 2014 Link to this post

    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 
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Jul 2014 Link to this post

    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.
     
  8. Mark
    Mark avatar
    18 posts
    Member since:
    Nov 2011

    Posted 26 Jan 2015 in reply to Jack Link to this post

    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.
  9. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 27 Jan 2015 Link to this post

    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.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready