Intersoft Support Center

Display Action Context Menu

This tutorial demonstrates how to use Action context menu in WebNotification. Action context menu provides a way for end users to access a list of available actions and perform an action against notification event.

  1. Drag WebNotification control from ToolBox into the WebForm.



  2. Create a WebService page in the same directory and name it "NotificationService.asmx". It will automatically create "NotificationService.cs" in the App_code folder. WebNotification control will look for GetNotifications method in the WebService. Use the following code for GetNotifications method:

    C# Copy Code
    [WebMethod]
    public WebNotificationEventCollection GetNotifications(WebNotificationEventArgs e)
    {        
       WebNotificationEventCollection collection = new WebNotificationEventCollection();        
       WebNotificationEvent evnt = new WebNotificationEvent();
    
       evnt.CaptionText = "Samples";        
       evnt.ContentText = "Hello world from WebNotification!\nCurrent time is:" + DateTime.Now.ToLongTimeString();
    
       collection.Notifications = new WebNotificationEvent[] { evnt };        
       return collection;
    }
    

  3. Open WebNotification Designer and set the following properties of WebNotification control:

    Properties Values
    ServiceType WebService
    ServiceUrl NotificationService.asmx
    ShowActionDropdown True



  4. Add some menu items in Items property and specify a function name for OnClick event.



  5. Add function doClick() that represents OnClick event:

    JavaScript Copy Code
    function doClick(mi)
    {   
       alert("Clicked : " + mi.Name);
    }
    

  6. Run the page. Menu items will be displayed when Action context menu is clicked.



    When the menu item is clicked, an alert box will be displayed.


Previous Next