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
- Select WebGrid's instance and press F4.
- In Layout Settings, select ClientSideEvents, then set OnRowContextMenu to WebGrid1_OnRowContextMenu.
- Write the following function in OnRowContextMenu client side event:
JavaScript Copy 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; }
- Run the project.
References
OnRowContextMenu Property
Other Resources
Walkthrough Topics
How-to Topics