Intersoft WebGrid Documentation
How-to: Add new menu items in Column Action
See Also Send comments on this topic.

Glossary Item Box

WebGrid also supports column action customization, for instances, adding new commands or displaying predefined filter menu similar to Windows Explorer.

In this topic, you will learn how to customize menu items in column action using OnColumnAction client side event.

To add new menu items in Column Action

  1. Bind WebGrid to AccessDataSource control.
  2. Drag WebContextMenu control from Toolbox.
  3. Right click on WebContextMenu control and choose Visual Menu Builder
  4. Create menu items according to your needs, for example:


  5. Enable Column Action.
  6. Put the following code in OnColumnAction client-side event to attach your custom column action.
    JavaScript Copy Code
    function OnColumnAction(controlId, column)
    {    
       if (column.Name == "ContactName") 
       {        
          var menu = ISGetObject("addItemMenu");        
          var grid = ISGetObject(controlId);        
          var eventLocation = menu.GetEventLocation();             
            
          eventLocation.X -= 8;        
          eventLocation.Y += 100;        
          menu.Show(eventLocation);        
          grid.ActionBoxShown = true;        
          return false;    
       }
    }
    

  7. Invoke OnColumnAction() method using OnColumnAction client side events in WebGrid.

    <ClientSideEvents OnColumnAction="OnColumnAction" />
    
  8. Run the project and it will look like following:



See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.