Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
345
How to disable delete key on keyboard and add a delete button instead for row deletion only
posted

 In my grid, I would like to have a delete button next to my add new button for deleting rows. Also, I'd like to use the delete key on the keyboard only for deleting contents of cells, not use it for deleting rows. Currently, I'm using automatic binding (using designer to create SQLDataSource and CRUD).

 Is this possible to do?

I need this functionality because users may unintentionally delete rows when they only meant to delete contents of a cell.

 

  • 7694
    posted

     Hello,

    You can use the client side event KeyDownHandler of ClientSideEvents and disable key “Delete” with JS code below:

    <ClientSideEvents KeyDownHandler="Action" />

    JS code:

     <script type="text/javascript">
            function Action(gridID, cellIDb, key) {
                if (key == 46) {
                    return true;
                }
            }
        
        </script>


    Also about the picture you can take  a look  at the link below:
    http://dotnetslackers.com/articles/aspnet/QuickGuideToImplementingTheNetAdvantageUltraWebGrid.aspx

    Hope this helps.