Altaf Khatri
Altaf Khatri



RSS feed for http://www.AltafKhatri.com website. Twitter account of http://www.AltafKhatri.com website.
∗Recently Added - How to take care of Betta fighter fish and increase life span?  10/30/2013


Find me on web

 LinkedIn

 Facebook

 Twitter

Devexpress - How to suppress backspace keypress on gridview focus?


While using devexpress controls for ASP.Net/ ASP.Net MVC, I ran into issue where when the focus was on gridview and then the user pressed the backspace key, the page will go back to the last page in history of browser. This was very annoying. I raised the ticket with Devexpress but had to find a resolution for myself as describing the situation why I had to focus on gridview was difficult to explain in the ticket.

I tried out several gridview control specific properties like:
settings.KeyboardSupport = true;

but it didn't help. I realized that the resolution had to be custom javascript solution rather than control property specific. I finally figured out the solution:
Use this script in the common javascript library, this will disable the backspace key press issue for all of your devexpress grids:

//Suppressing backspace keypress on grid focus 

    $(document).keydown(function (e) {

        if (e.which === 8 && "TABLE" === document.activeElement.tagName) {

            return false;

        }

    });




Like the performance of this website?
Host your website for cheap(under $5) and have good performance.





SiteMap  |  Contact Me