Enter key for moving to next cell on a new row when the cell is set to ReadOnly

12 posts, 1 answers
  1. Avi
    Avi avatar
    2 posts
    Member since:
    Jul 2011

    Posted 06 Nov 2011 Link to this post

    Hi,

    I use RadControls for WinForms Q2 2011.

    I've set a column on my grid to ReadOnly for both EnterKeyMode and NewRowEnterKeyMode.

    When navigating through cells with either Tab or Enter keys - it works fine and it jumps to the next editable cell. But, When navigating with Enter key on a new row through the read-only column - it stays on that cell and doesn't move on. I need to use Esc, arrows or mouse to release it.

    Is it the right behavior? If so, is there some workaround for that?

    Best Regards,

    Boaz
  2. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 10 Nov 2011 Link to this post

    Hi Avi,

    Thank you for writing and sorry for the late response.

    When you press the Enter key in EnterMovesToNextCell we always move to the next cell and we consider this behavior as normal. In case that the cell is read-only you cannot edit it and should press enter again.
    You can easy workaround this behavior. You  should CurrentColumnChanged event and skip the column if the column is ReadOnly:

    this.radGridView1.CurrentColumnChanged += new Telerik.WinControls.UI.CurrentColumnChangedEventHandler(radGridView1_CurrentColumnChanged);          
            }
             
            void radGridView1_CurrentColumnChanged(object sender, Telerik.WinControls.UI.CurrentColumnChangedEventArgs e)
            {
                if (e.NewColumn.ReadOnly)
                {
                    int nextIndex = e.NewColumn.Index + 1;
                    if (nextIndex >= this.radGridView1.Columns.Count)
                    {
                        nextIndex = 0;
                    }
     
                    this.radGridView1.CurrentColumn = this.radGridView1.Columns[nextIndex];
                }
            }

    Please, refer to the attached project.
    I hope this helps.

    Kind regards,
    Peter
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  3. Taha
    Taha avatar
    2 posts
    Member since:
    Feb 2012

    Posted 02 Feb 2012 Link to this post

    Hi
    1 ) I want to change position tab between cells by enter key but I can't
    2)  if tab was last cell, by enter key create new row and tab go to first cell in new row

    tnx alot....
  4. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 06 Feb 2012 Link to this post

    Hello Taha,

    Thank you for writing.

    1) In order to change the current cell with Enter key instead of the Tab key, you should set RadGridView's EnterKeyMode property to EnterMovesToNextCell:

    radGridView1.EnterKeyMode = RadGridViewEnterKeyMode.EnterMovesToNextCell;

    2) You should set RadGridView's NewRowEnterKeyMode property to EnterMovesToNextCell
    radGridView1.NewRowEnterKeyMode = RadGridViewNewRowEnterKeyMode.EnterMovesToNextCell;

    I hope this helps. Do not hesitate to contact us if you have other questions.

    Regards,
    Peter
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

  5. Taha
    Taha avatar
    2 posts
    Member since:
    Feb 2012

    Posted 07 Feb 2012 Link to this post

    Hi
    i 'm taha
    About Question 2 , So i could't create new row by enter key when tab
    is last cell in last row
    please help me.
    tnx
  6. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 09 Feb 2012 Link to this post

    Hi,

    You should set RadGridView's AllowAddNewRow property to true.
    When set to true an empty row is added in which the user can enter data for the new record.

    radGridView1.AllowAddNewRow = true;

    I hope this helps. Kind regards,
    Peter
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. Curtis
    Curtis avatar
    2 posts
    Member since:
    Aug 2010

    Posted 30 Nov 2012 Link to this post

    When I edit a cell on the RadGridView and then tab to any other cell (not hit Enter), my application "bombs" (just shuts down).  My code only implements the CellFormatting and CellValueChanged events of the RadGridView.  If I remove (comment out) both events, I can edit a cell and tab to any other cell without the application shutting down.
  8. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 05 Dec 2012 Link to this post

    Hello Curtis,

    Thank you for writing.

    I have to debug your custom logic in the CellFormatting and CellValueChanged events in order to find what causes this behavior. It is possible to send us a small build-able project where the issue can be reproduced? You can do that in a new support ticket.

    A bit of topic, I would kindly ask you to open a new thread for each question that is not related to the main topic of the existing threads. This will avoid mixing several different topics in one thread, hence our community will be able to find information for the topics more easily in case it is interested.

    Thank you for the understanding.

    Greetings,
    Peter
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  9. Curtis
    Curtis avatar
    2 posts
    Member since:
    Aug 2010

    Posted 05 Dec 2012 Link to this post

    Hello, Peter

    I figured out what was causing the problem.  In the CellValueChanged event, I called a method I wrote that sets the gridview's DataSource property to Nothing before reassigning it to a DataSet (in effect, clearing the gridview first).  When I deleted the code line that assigned Nothing to its DataSource property, the problem was eliminated.

    Thanks for your prompt reply, Peter.

    Regards,

    Curtis
  10. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 07 Dec 2012 Link to this post

    Hello Curtis,

    Thank you for sharing this with us - I am happy that you managed to find a solution for this case. 

    Do not hesitate to contact us if you have other questions.

    All the best,
    Peter
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  11. Ali
    Ali avatar
    1 posts
    Member since:
    Dec 2017

    Posted 10 Dec 2017 Link to this post

    Hi Peter,

    I'm facing a similar kind of issue when I try to enter a value in the cell and either use Tab or Enter. It works fine for both, but when I come back to the same cell and wants to change first entered value. I can change that value, but can't get out from that cell either by using Enter or Tab command or by clinking with mouse to another cell.
    I have to use Escape key or F2 command to get out from that cell, but I lose my change, I don't want to use this Escape or F2 option.

    Is there any solution via using Tab or Enter as it works first time?

    Many Thanks
    Ali
  12. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3008 posts

    Posted 12 Dec 2017 Link to this post

    Hello, Ali,

    Thank you for writing.  

    Following the provided information, I was unable to reproduce the issue you are facing. Please refer to the attached gif file illustrating the behavior on my end with the specified version. I have attached my sample project. Could you please specify the exact steps how to reproduce the problem? Alternatively, you can submit a support ticket where you can provide all the necessary information together with a sample project demonstrating the problem. Thus, we would be able to investigate the precise case and assist you further. Thank you. 

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top