Spread for ASP.NET 7.0 Product Documentation
SelectedItem Property
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > MenuItemClickEventArgs Class : SelectedItem Property


Glossary Item Box

Gets the selected item.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property SelectedItem As MenuItem
Visual Basic (Usage)Copy Code
Dim instance As MenuItemClickEventArgs
Dim value As MenuItem
 
value = instance.SelectedItem
C# 
public MenuItem SelectedItem {get;}

Example

This example uses the SelectedItem property.
C#Copy Code
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;
rowHeaderItem.ChildItems[0].CommandName = "1st";
rowHeaderItem.ChildItems[1].CommandName = "test";
rowHeaderItem.ChildItems[0].CommandArgument = "arg0";
rowHeaderItem.ChildItems[1].CommandArgument = "arg1";
rowHeaderContextMenu.Items.Add(rowHeaderItem);
FpSpread1.ContextMenus.Add(rowHeaderContextMenu); 
}

 protected void FpSpread1_MenuItemClicked(object sender, FarPoint.Web.Spread.MenuItemClickEventArgs eventArgs)
        {
            FpSpread1.Sheets[0].Cells[1,1].Text = eventArgs.SelectedItem.CommandName.ToString();
            FpSpread1.Sheets[0].Cells[1, 2].Text = eventArgs.SelectedItem.CommandArgument.ToString();
        }
VB.NETCopy Code
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
rowHeaderItem.ChildItems(0).CommandName = "1st"
rowHeaderItem.ChildItems(1).CommandName = "test"
rowHeaderItem.ChildItems(0).CommandArgument = "arg0"
rowHeaderItem.ChildItems(1).CommandArgument = "arg1"
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
FpSpread1.Sheets(0).Cells(1,1).Text = eventArgs.SelectedItem.CommandName.ToString()
FpSpread1.Sheets(0).Cells(1, 2).Text = eventArgs.SelectedItem.CommandArgument.ToString()
End Sub

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.