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

Allow Keyboard navigation but execute postback in rowclick(mouse click) or Enter key

5 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nelbin
Top achievements
Rank 1
Nelbin asked on 25 Jul 2013, 01:48 AM
     <ClientSettings AllowKeyboardNavigation="true"  EnablePostBackOnRowClick="true" >
   <ClientEvents />
   <KeyboardNavigationSettings EnableKeyboardShortcuts="true" />
   <Selecting AllowRowSelect="true"  />
</ClientSettings>
Good day  there seems to be a problem with my code, I know the keyboard navigation works(browsing through the grid list using up and down keys) but the mouseclick doesnt work(not executing the postback). I have a function that executes on postback. and also can I change the enter keys function by executing my function instead of editing the data.

5 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 29 Jul 2013, 01:47 PM
Hi Nelbin,

You can use the following approach:
<ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
    <ClientEvents OnKeyPress="keyPress" />
    <Selecting AllowRowSelect="true" />
</ClientSettings>
JavaScript:
function keyPress(sender, args) {
    if (args.get_keyCode() == 13) {
        args.set_cancel(true);
        if (sender._activeRow) {
            sender._activeRow.click();
        }
    }
}

Alternatively, you can fire grid commands using the method demonstrated in the following article:
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-firecommand.html

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
Nelbin
Top achievements
Rank 1
answered on 01 Aug 2013, 01:01 AM
Hi Eyup,

The keyboard navigation isn't working on what you gave. But the mouse click is. Also my current code has a Onrowselected function, during a rowselect I get a data in ClientDataKeyNames via javascript. I tried your code with and without my OnRowSelected function still it doesn't move by key nav
0
Eyup
Telerik team
answered on 02 Aug 2013, 08:23 AM
Hello Nelbin,

I have prepared a sample RadGrid web site to demonstrate that the suggested approach works as expected. Can you please run the attached application and verify that the keyboard navigation works correctly on your side, too?

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
Nelbin
Top achievements
Rank 1
answered on 14 Aug 2013, 08:12 AM
Hi Eyup, 

Still no luck with the help you gave me, I am really not sure why isn't my code working
0
Eyup
Telerik team
answered on 16 Aug 2013, 11:19 AM
Hi Nelbin,

In that case, please provide us the exact steps to reproduce the issue or open a support ticket to send us a sample runnable application demonstrating the erratic behavior. Thus, we will be able to further analyze the problem and provide a proper solution.

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.
Tags
Grid
Asked by
Nelbin
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Nelbin
Top achievements
Rank 1
Share this question
or