Create your own specific row context menu on WebGrid

Sometimes users don’t want to use default row context on WebGrid.NET. Some of them prefer to have their own row context menu on WebGrid. This article will show you how to integrate your own WebContextMenu from WebDesktop.NET into WebGrid.NET.

First, you need to create your own WebContextMenu. In this sample I created two WebContextMenu’s named WBContextMenuSR (for Sales Representative) and WBContextMenuSM (for Sales Manager).


Screenshot of WBContextMenuSR (for Sales Representative)


Screenshot of WBContextMenuSM (for Sales Manager)

In this scenario, you need to use OnRowContextMenu client side event in order to show your default context menu and don’t forget to set return false; in order to prevent WebGrid’s default context menu displayed. Here is the sample codes:

For more detail information, you can download the sample here. Hope this helps. Please feel free to put your comment..:)

Comments

  1. Hello,
    I have a question about custom contextmenu in UXGridView in WPF project.
    How can I use my own contextmenu i UXGridView?
    I created contextmenu put in UXGridView by Intersoft:ContextMenuService.ContextMenu=”{Binding ElementName=ContextMenu1}”
    but its not working.

    Best Regards
    Chris Mietka

Leave a Reply