Spread for ASP.NET 7.0 Product Documentation
ContextMenuType Enumeration
Example  See Also  Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace : ContextMenuType Enumeration


Glossary Item Box

The Spread menu types.

Syntax

Visual Basic (Declaration) 
Public Enum ContextMenuType 
   Inherits System.Enum
Visual Basic (Usage)Copy Code
Dim instance As ContextMenuType
C# 
public enum ContextMenuType : System.Enum 

Members

MemberDescription
ColumnHeaderSpecifies the column header context menu
RowHeaderSpecifies the row header context menu
ViewportSpecifies the viewport context menu

Example

This example uses the ContextMenuType enumeration.
C#Copy Code
//Markup code
<ContextMenus> 
        <FarPoint:ContextMenu Type="Viewport"> 
          <Items> 
            <FarPoint:MenuItem Enabled="True" ImageUrl="http://linktoimagehere/abc.jpc" Text="Menu item 1"> 
                <ItemTemplate> 
                <asp:TextBox ID="bac" runat="server" /> 
                </ItemTemplate> 
            </FarPoint:MenuItem> 
            <FarPoint:MenuItem Text="Sort" ImageUrl="http://linktoimagehere/abc.jpc"> 
                <ChildItems >                  
                  <FarPoint:MenuItem  Text="Child Item1"  ImageUrl="http://avc/abc.jpc"></FarPoint:MenuItem> 
                  <FarPoint:MenuItem Text="Child Item2"></FarPoint:MenuItem> 
                </ChildItems> 
            </FarPoint:MenuItem> 
            <FarPoint:MenuItem Enabled="True" ImageUrl="http://linktoimagehere/abc.jpc">Menu item 3</FarPoint:MenuItem> 
          </Items> 
        </FarPoint:ContextMenu> 
      </ContextMenus> 

protected void Page_Load(object sender, System.EventArgs e)
{
if (this.IsPostBack) return;
FpSpread1.EnableContextMenu = true;
//Create this viewport menu using markup or the ContextMenus property in the property window
FarPoint.Web.Spread.ContextMenu viewportMenu = FpSpread1.ContextMenus[FarPoint.Web.Spread.ContextMenuType.Viewport];
FarPoint.Web.Spread.MenuItem customViewportItem = new FarPoint.Web.Spread.MenuItem("Viewport item 1");
customViewportItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 1"));
customViewportItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 2"));
viewportMenu.Items.Add(customViewportItem);

//This row header menu is created here (no markup or design properties) 
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"));
rowHeaderContextMenu.Items.Add(rowHeaderItem);
FpSpread1.ContextMenus.Add(rowHeaderContextMenu); 
}
VB.NETCopy Code
//Markup code
<ContextMenus> 
        <FarPoint:ContextMenu Type="Viewport"> 
          <Items> 
            <FarPoint:MenuItem Enabled="True" ImageUrl="http://linktoimagehere/abc.jpc" Text="Menu item 1"> 
                <ItemTemplate> 
                <asp:TextBox ID="bac" runat="server" /> 
                </ItemTemplate> 
            </FarPoint:MenuItem> 
            <FarPoint:MenuItem Text="Sort" ImageUrl="http://linktoimagehere/abc.jpc"> 
                <ChildItems >                  
                  <FarPoint:MenuItem  Text="Child Item1"  ImageUrl="http://avc/abc.jpc"></FarPoint:MenuItem> 
                  <FarPoint:MenuItem Text="Child Item2"></FarPoint:MenuItem> 
                </ChildItems> 
            </FarPoint:MenuItem> 
            <FarPoint:MenuItem Enabled="True" ImageUrl="http://linktoimagehere/abc.jpc">Menu item 3</FarPoint:MenuItem> 
          </Items> 
        </FarPoint:ContextMenu> 
      </ContextMenus> 

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
'Create this viewport menu using markup or the ContextMenus property in the property window
Dim viewportMenu As FarPoint.Web.Spread.ContextMenu = FpSpread1.ContextMenus(FarPoint.Web.Spread.ContextMenuType.Viewport)
Dim customViewportItem As New FarPoint.Web.Spread.MenuItem("Viewport item 1")
customViewportItem.ChildItems.Add(New FarPoint.Web.Spread.MenuItem("Child item 1"))
customViewportItem.ChildItems.Add(New FarPoint.Web.Spread.MenuItem("Child item 2"))
viewportMenu.Items.Add(customViewportItem)

'This row header menu is created here (no markup or design properties)  
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"))
rowHeaderContextMenu.Items.Add(rowHeaderItem)
FpSpread1.ContextMenus.Add(rowHeaderContextMenu)
End Sub

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         FarPoint.Web.Spread.ContextMenuType

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.