Spread for ASP.NET 10 Product Documentation
MenuItemClicked Event
Example 


Occurs when the Spread context menu item is clicked.
Syntax
'Declaration
 
Public Event MenuItemClicked As MenuItemClickedHandler
'Usage
 
Dim instance As FpSpread
Dim handler As MenuItemClickedHandler
 
AddHandler instance.MenuItemClicked, handler
public event MenuItemClickedHandler MenuItemClicked
Event Data

The event handler receives an argument of type MenuItemClickEventArgs containing data related to this event. The following MenuItemClickEventArgs properties provide information specific to this event.

PropertyDescription
MenuTypeGets the type of the menu.  
SelectedItemGets the selected item.  
Example
This example uses the MenuItemClicked event.
protected void Page_Load(object sender, System.EventArgs e)
{
if (this.IsPostBack) return;
FpSpread1.EnableContextMenu = true;
FarPoint.Web.Spread.ContextMenu rowHeaderContextMenu = new FarPoint.Web.Spread.ContextMenu();
rowHeaderContextMenu.Type = FarPoint.Web.Spread.ContextMenuType.RowHeader;
FarPoint.Web.Spread.MenuItem rowHeaderItem = new FarPoint.Web.Spread.MenuItem("RowHeader item 1");
rowHeaderItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 1"));
rowHeaderItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 2"));
rowHeaderItem.ChildItems[1].Visible = true;
rowHeaderContextMenu.Items.Add(rowHeaderItem);
FpSpread1.ContextMenus.Add(rowHeaderContextMenu); 
}

protected void FpSpread1_MenuItemClicked(object sender, FarPoint.Web.Spread.MenuItemClickEventArgs eventArgs)
{
label1.Text = eventArgs.MenuType.ToString();
label1.Text = eventArgs.SelectedItem.ToString();
}
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (IsPostBack) Then
    Return
End If
FpSpread1.EnableContextMenu = True
'If the RowHeader context menu has not been added, add it here 
Dim rowHeaderContextMenu As New FarPoint.Web.Spread.ContextMenu()
rowHeaderContextMenu.Type = FarPoint.Web.Spread.ContextMenuType.RowHeader
Dim rowHeaderItem As New FarPoint.Web.Spread.MenuItem("RowHeader item 1")
rowHeaderItem.ChildItems.Add(New FarPoint.Web.Spread.MenuItem("Child item 1"))
rowHeaderItem.ChildItems.Add(New FarPoint.Web.Spread.MenuItem("Child item 2"))
rowHeaderItem.ChildItems(1).Visible = True
rowHeaderContextMenu.Items.Add(rowHeaderItem)
FpSpread1.ContextMenus.Add(rowHeaderContextMenu)
End Sub

Protected Sub FpSpread1_MenuItemClicked(sender As Object, eventArgs As FarPoint.Web.Spread.MenuItemClickEventArgs) Handles FpSpread1.MenuItemClicked
Label1.Text = eventArgs.MenuType.ToString()
Label1.Text = eventArgs.SelectedItem.ToString()
End Sub
Requirements

Target Platforms: Windows 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional

See Also

Reference

FpSpread Class
FpSpread Members

 

 


Copyright © GrapeCity, inc. All rights reserved.