RadGrid hit enter anywhere on page fires the Delete command

7 posts, 0 answers
  1. Ray Merckel
    Ray Merckel avatar
    5 posts
    Member since:
    Mar 2009

    Posted 04 Jan 2010 Link to this post

    Requirements

    RadControls version 2009.1.527.39

     

    .NET version

    3.5

    Visual Studio version

    2008

    programming language

    C# or VB

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    [When there is a RadGrid on a page, if a user hits "Enter" the Delete command from the grid fires... Attached is a javascript function to trap the enter key so that it does not fire the Delete command. Also if you have multi line textboxes and would like to enable the enter key see notes for code behind.]
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 05 Jan 2010 Link to this post

    Hello Ray,

    Thank you for the provided code snippets. The behavior you depicted can be observed when you have delete column in the grid and one of the buttons in it happens to be the first submit button on the page when the end user pressed the [ENTER] key from the keyboard.

    How to prevent the unwanted delete operation from being triggered you can see from the implementation on this online demo (see the SuppressBubbling javascript method). It seems that you discovered an alternative solution and hence I am converting this thread to a forum post in order to be available for other members from the Telerik community. I also updated your Telerik points for the involvement.

    Kind regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Ray Merckel
    Ray Merckel avatar
    5 posts
    Member since:
    Mar 2009

    Posted 05 Jan 2010 Link to this post

    hello,
    i went to your online demo and if you click on the scroll bar, let go of the mouse, and hit the enter key, it still asks you "Are you sure you want to Delete this record?"
    thats exactly what i dont want to happen and that is why i posted the code...

    thank you
  4. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 08 Jan 2010 Link to this post

    Hi Ray,

    In this case, you can suppress the event bubbling on a page-level. You can assign an onkeydown client side event handler for the whole form, and cancel out the enter key press, when it is not necessary.
    Naturally, the approach which you came up initially with, can also be used.
    I am sure the community will find one of these approaches useful.

    Greetings,
    Yavor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Upender
    Upender avatar
    5 posts
    Member since:
    Oct 2017

    Posted 29 Nov 2018 in reply to Sebastian Link to this post

    Hi Team, I am unable to find the SuppressBubbling javascript method in above mentioned demo.
  6. Eyup
    Admin
    Eyup avatar
    3692 posts

    Posted 04 Dec 2018 Link to this post

    Hello Upender,

    You can use a hidden button to achieve this requirement:
    https://www.telerik.com/forums/radgrid-disable-enter-key#KAn1O5APR0SaXfk3MrhL9Q

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Upender
    Upender avatar
    5 posts
    Member since:
    Oct 2017

    Posted 05 Dec 2018 in reply to Eyup Link to this post

    Thanks Eyup. Its working for me :)
Back to Top