• How to implement keyboard shortcuts in ASP.NET using jQuery

    by  • June 27, 2013 • jQuery and Microsoft .NET, Microsoft ASP.NET • 0 Comments

    It is a great comfort for a user to be mouseless while navigating between web pages. They need shortcut keys to go to other page and also to do something on the current page. Keyboard shortcuts are easy to implement using jQuery in ASP.NET. Let’s take a look how we can achieve this task. You can download complete source code at the bottom.

    Download any jQuery stable version and add to your project.

    Don’t forget to give reference for jQuery file.

    Add three links

    I am using a CSS class for styling

    Now right code below to implement keyboard shortcuts in ASP.NET

    In the code above, I am checking key codes 65, 66, 67 for ‘a’, ‘b’ and ‘c’ respectively and getting link name attributes. Then I am using trigger function to trigger click event of links. In the click event, I am redirecting to the mentioned page in the “href” attribute of the link by using window.location.




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply