Intersoft WebGrid Documentation
How-to: Display Delete menu item in WebGrid's context menu when in a specific row using OnRowContextMenu
See Also Send comments on this topic.

Glossary Item Box

This walkthrough shows you how to use OnRowContextMenu client side event.

In this topic, you will learn the basic thing on how to display delete menu item in WebGrid's context menu using OnRowContextMenu.

To display delete menu item in WebGrid's context menu using OnRowContextMenu

  1. Select WebGrid's instance and press F4.
  2. In Layout Settings, select ClientSideEvents, then set OnRowContextMenu to WebGrid1_OnRowContextMenu.
  3. Write the following function in OnRowContextMenu client side event:

    JavaScript Copy ImageCopy Code
    function WebGrid1_OnRowContextMenu(controlId, rowType, rowElement, menuObject)
    {
            var WebGrid1 = ISGetObject(controlId); 
            var cell = rowElement.cells[10].innerText;
            if (rowType == "Record"&& cell == "UK")  
            {    
              menuObject.add( new MenuSeparator() );     
              menuObject.add( new MenuItem("DeleteRow", function() {delete();}));
            }
            return true;
    }
    

  4. Run the project.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.