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

RadGrid disable enter key

8 Answers 912 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Owen
Top achievements
Rank 1
Owen asked on 14 Nov 2013, 11:14 PM
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



8 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 19 Nov 2013, 12:51 PM
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.
0
Owen
Top achievements
Rank 1
answered on 19 Nov 2013, 05:40 PM
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.
0
Deepak
Top achievements
Rank 1
answered on 09 Jan 2014, 03:33 PM
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. 
0
Konstantin Dikov
Telerik team
answered on 14 Jan 2014, 08:38 AM
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.
0
Deepak
Top achievements
Rank 1
answered on 17 Jan 2014, 06:56 AM
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.
0
Konstantin Dikov
Telerik team
answered on 20 Jan 2014, 04:00 PM
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.
0
Deepak
Top achievements
Rank 1
answered on 22 Jan 2014, 11:02 AM
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


0
Konstantin Dikov
Telerik team
answered on 27 Jan 2014, 08:19 AM
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.
Tags
Grid
Asked by
Owen
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Owen
Top achievements
Rank 1
Deepak
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or