RadGrid disable enter key

9 posts, 0 answers
  1. Owen
    Owen avatar
    12 posts
    Member since:
    May 2013

    Posted 14 Nov 2013 Link to this post

    How do I disable the enter key rebind on RadGrid? I can't find a setting to either make the entire table read only, or just disable the enter key.

    AllowKeyboardNavigation = "false" and <KeyboardNavigationSettings EnableKeyboardShortcuts="false" AllowSubmitOnEnter="false" /> do not disable the enter key. There is no need for this functionality to be permanently on. Rebinding 10,000 rows because someone accidentally hit enter is not a valid option.

    Programming this via javascript seems hokey and cheap as a workaround, but if that's my only option... 

    Please assist.

    Regards,
    ~Owen



  2. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 19 Nov 2013 Link to this post

    Hello Owen,

    Generally, when there is a submit initiator on the page - the browser assigns it as the default button for submitting. This is a general behavior and not Telerik specific - you can also try it with a regular ASP controls.

    Therefore, in order to prevent the submit action on Enter key press, you can create a hidden button and use it as the form defaultbutton to achieve the requested functionality:
    Copy Code
    <form id="form1" runat="server" defaultbutton="HiddenButtonUniqueID">
        <asp:Button ID="HiddenButtonUniqueID" runat="server" Text="Button" Style="display: none;" OnClientClick="return false;" />

    You can also want to disable the default button only for the grid - the solution is to use Panels:
    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.panel.defaultbutton.aspx

    Alternatively, you can use the following approach:
    Copy Code
        <ClientEvents OnKeyPress="keyPress" />
    JavaScript:
    Copy Code
    function keyPress(sender, args) {
        if (args.get_keyCode() == 13) {
            args.set_cancel(true);
        }
    }

    Hope this helps. Please give it a try and let me know if it works for you.

    Regards,
    Eyup
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Owen
    Owen avatar
    12 posts
    Member since:
    May 2013

    Posted 19 Nov 2013 Link to this post

    Eyup,

    Thank you for your response. I am unable to set default at the form level since the form is defined on the master page. However, I was able to set the javascript keyPress function to handle the enter key event on the master page and implement it on every RadGrid. It still kicks up a loading window every now and then, but it isn't trying to rebind the grid or launch into edit mode every time. This will work for now.

    Regards,
    Owen

    Update: I also had to catch the keypress for the Delete key and dismiss it in the same javascript call. Minor annoyances, but I'm happy they no longer plague me.
  5. Deepak
    Deepak avatar
    9 posts
    Member since:
    Sep 2013

    Posted 09 Jan 2014 Link to this post

    Hi Eyup,

    Thanks for replying, as your suggestion on this below link

    http://www.telerik.com/community/forums/aspnet-ajax/grid/filter-list-alignment-issue-for-grid.aspx

    I removed JavaScript method, and according to your comment (this link) I restrict enter key then the user have to click on filter icon for showing filter in appropriate place this one works fine, but this is not my client requirement they want press tab and press enter and the filter icon have to came on exact below of this filter icon after scrolling as well. 
  6. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1795 posts

    Posted 14 Jan 2014 Link to this post

    Hello Deepak,

    We are already aware of the issue that you are describing and our developers team should introduce a fix for it in one of our future releases as soon as such is available.

    In the meantime you could follow the progress of the issue in our Ideas & Feedback Portal:

    Please excuse us for any inconvenience caused by this.


    Regards,
    Konstantin Dikov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  7. Deepak
    Deepak avatar
    9 posts
    Member since:
    Sep 2013

    Posted 17 Jan 2014 Link to this post

    Hi Konstantin Dikov,

    Thanks for replying.
    But the given link is not working for me, here filter menu is appears and immediately disappears but this type of solution i got and i gave it in my previous comment in below link

    http://www.telerik.com/community/forums/aspnet-ajax/grid/filter-list-alignment-issue-for-grid.aspx

    Here filter menu is appears perfectly but after scrolling horizontally and vertically then filter menu is not appears in it's actual position.
  8. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1795 posts

    Posted 20 Jan 2014 Link to this post

    Hello Deepak,

    If you are observing the described issue in Chrome only, there is a known issue with the latest Chrome version (32) and our developers team are aware of it too and a fix should be provided in our next release.

    You could have a look at this forum thread, where a workaround for this is provided. Please give it a try and see if it helps.


    Regards,
    Konstantin Dikov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  9. Deepak
    Deepak avatar
    9 posts
    Member since:
    Sep 2013

    Posted 22 Jan 2014 Link to this post

    Hi Konstantin Dikov,

    Thanks for replying.
    This issue is not coming with only Chrome(Version-32). This issue is appears on all browsers. I thoroughly checked it.
    So please go through my previous comments and if you have any other solutions, please give me.


    Thanks,
    Deepak


  10. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1795 posts

    Posted 27 Jan 2014 Link to this post

    Hello Deepak,

    The Chrome related issue I was referring to was the positioning of the filter menu after scrolling. We are aware of that issue and a fix for it should be available in our next release. 

    Regarding the other issue you are facing, without having a sample project to test locally, the only things that I could suggest are the following:
    • Ensure that you are not setting the AutoPostBackOnFilter to "true";
    • Ensure that no JavaScript errors that could prevent the proper work of the controls are present on the page.

    If you continue to face the issue, please open a regular support ticket with sample, runnable project attached, so we could inspect it locally and provide you a relevant to your scenario solution.


    Regards,
    Konstantin Dikov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017