Menu Class

 

Displays a menu in an ASP.NET Web page.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)


[ControlValuePropertyAttribute("SelectedValue")]
public class Menu : HierarchicalDataBoundControl, IPostBackEventHandler, 
	INamingContainer

NameDescription
System_CAPS_pubmethodMenu()

Initializes a new instance of the Menu class.

NameDescription
System_CAPS_pubpropertyAccessKey

Gets or sets the access key that allows you to quickly navigate to the Web server control.(Inherited from WebControl.)

System_CAPS_protpropertyAdapter

Gets the browser-specific adapter for the control.(Inherited from Control.)

System_CAPS_pubpropertyAppRelativeTemplateSourceDirectory

Gets or sets the application-relative virtual directory of the Page or UserControl object that contains this control.(Inherited from Control.)

System_CAPS_pubpropertyAttributes

Gets the collection of arbitrary attributes (for rendering only) that do not correspond to properties on the control.(Inherited from WebControl.)

System_CAPS_pubpropertyBackColor

Gets or sets the background color of the Web server control.(Inherited from WebControl.)

System_CAPS_pubpropertyBindingContainer

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the control that contains this control's data binding.(Inherited from Control.)

System_CAPS_pubpropertyBorderColor

Gets or sets the border color of the Web control.(Inherited from WebControl.)

System_CAPS_pubpropertyBorderStyle

Gets or sets the border style of the Web server control.(Inherited from WebControl.)

System_CAPS_pubpropertyBorderWidth

Gets or sets the border width of the Web server control.(Inherited from WebControl.)

System_CAPS_protpropertyChildControlsCreated

Gets a value that indicates whether the server control's child controls have been created.(Inherited from Control.)

System_CAPS_pubpropertyClientID

Gets the control ID for HTML markup that is generated by ASP.NET.(Inherited from Control.)

System_CAPS_pubpropertyClientIDMode

Gets or sets the algorithm that is used to generate the value of the ClientID property.(Inherited from Control.)

System_CAPS_protpropertyClientIDSeparator

Gets a character value representing the separator character used in the ClientID property.(Inherited from Control.)

System_CAPS_protpropertyContext

Gets the HttpContext object associated with the server control for the current Web request.(Inherited from Control.)

System_CAPS_pubpropertyControls

Gets a ControlCollection that contains the child controls of the Menu control.(Overrides Control.Controls.)

System_CAPS_pubpropertyControlStyle

Gets the style of the Web server control. This property is used primarily by control developers.(Inherited from WebControl.)

System_CAPS_pubpropertyControlStyleCreated

Gets a value indicating whether a Style object has been created for the ControlStyle property. This property is primarily used by control developers.(Inherited from WebControl.)

System_CAPS_pubpropertyCssClass

Gets or sets the Cascading Style Sheet (CSS) class rendered by the Web server control on the client.(Inherited from WebControl.)

System_CAPS_pubpropertyDataBindings

Gets a collection of MenuItemBinding objects that define the relationship between a data item and the menu item it is binding to.

System_CAPS_pubpropertyDataItemContainer

Gets a reference to the naming container if the naming container implements IDataItemContainer.(Inherited from Control.)

System_CAPS_pubpropertyDataKeysContainer

Gets a reference to the naming container if the naming container implements IDataKeysControl.(Inherited from Control.)

System_CAPS_pubpropertyDataSource

Gets or sets the object from which the data-bound control retrieves its list of data items.(Inherited from BaseDataBoundControl.)

System_CAPS_pubpropertyDataSourceID

Gets or sets the ID of the control from which the data-bound control retrieves its list of data items.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protpropertyDesignMode

Gets a value indicating whether a control is being used on a design surface.(Inherited from Control.)

System_CAPS_pubpropertyDisappearAfter

Gets or sets the duration for which a dynamic menu is displayed after the mouse pointer is no longer positioned over the menu.

System_CAPS_pubpropertyDynamicBottomSeparatorImageUrl

Gets or sets the URL to an image to display at the bottom of each dynamic menu item to separate it from other menu items.

System_CAPS_pubpropertyDynamicEnableDefaultPopOutImage

Gets or sets a value indicating whether the built-in image that indicates that a dynamic menu item has a submenu is displayed.

System_CAPS_pubpropertyDynamicHorizontalOffset

Gets or sets the number of pixels to shift a dynamic menu horizontally relative to its parent menu item.

System_CAPS_pubpropertyDynamicHoverStyle

Gets a reference to the Style object that allows you to set the appearance of a dynamic menu item when the mouse pointer is positioned over it.

System_CAPS_pubpropertyDynamicItemFormatString

Gets or sets additional text shown with all menu items that are dynamically displayed.

System_CAPS_pubpropertyDynamicItemTemplate

Gets or sets the template that contains the custom content to render for a dynamic menu.

System_CAPS_pubpropertyDynamicMenuItemStyle

Gets a reference to the MenuItemStyle object that allows you to set the appearance of the menu items within a dynamic menu.

System_CAPS_pubpropertyDynamicMenuStyle

Gets a reference to the MenuItemStyle object that allows you to set the appearance of a dynamic menu.

System_CAPS_pubpropertyDynamicPopOutImageTextFormatString

Gets or sets the alternate text for the image used to indicate that a dynamic menu item has a submenu.

System_CAPS_pubpropertyDynamicPopOutImageUrl

Gets or sets the URL to a custom image that is displayed in a dynamic menu item when the dynamic menu item has a submenu.

System_CAPS_pubpropertyDynamicSelectedStyle

Gets a reference to the MenuItemStyle object that allows you to set the appearance of the dynamic menu item selected by the user.

System_CAPS_pubpropertyDynamicTopSeparatorImageUrl

Gets or sets the URL to an image to display at the top of each dynamic menu item to separate it from other menu items.

System_CAPS_pubpropertyDynamicVerticalOffset

Gets or sets the number of pixels to shift a dynamic menu vertically relative to its parent menu item.

System_CAPS_pubpropertyEnabled

Gets or sets a value indicating whether the Web server control is enabled.(Inherited from WebControl.)

System_CAPS_pubpropertyEnableTheming

Gets or sets a value indicating whether themes apply to this control.(Inherited from WebControl.)

System_CAPS_pubpropertyEnableViewState

Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client.(Inherited from Control.)

System_CAPS_protpropertyEvents

Gets a list of event handler delegates for the control. This property is read-only.(Inherited from Control.)

System_CAPS_pubpropertyFont

Gets the font properties associated with the Web server control.(Inherited from WebControl.)

System_CAPS_pubpropertyForeColor

Gets or sets the foreground color (typically the color of the text) of the Web server control.(Inherited from WebControl.)

System_CAPS_pubpropertyHasAttributes

Gets a value indicating whether the control has attributes set.(Inherited from WebControl.)

System_CAPS_protpropertyHasChildViewState

Gets a value indicating whether the current server control's child controls have any saved view-state settings.(Inherited from Control.)

System_CAPS_pubpropertyHeight

Gets or sets the height of the Web server control.(Inherited from WebControl.)

System_CAPS_pubpropertyID

Gets or sets the programmatic identifier assigned to the server control.(Inherited from Control.)

System_CAPS_protpropertyIdSeparator

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the character used to separate control identifiers.(Inherited from Control.)

System_CAPS_pubpropertyIncludeStyleBlock

Gets or sets a value that indicates whether ASP.NET should render a block of cascading style sheet (CSS) definitions for the styles that are used in the menu.

System_CAPS_protpropertyInitialized

Gets a value indicating whether the data-bound control has been initialized.(Inherited from BaseDataBoundControl.)

System_CAPS_protpropertyIsBoundUsingDataSourceID

Gets a value indicating whether the DataSourceID property is set.(Inherited from BaseDataBoundControl.)

System_CAPS_protpropertyIsChildControlStateCleared

Gets a value indicating whether controls contained within this control have control state.(Inherited from Control.)

System_CAPS_protpropertyIsDataBindingAutomatic

Gets a value that indicates whether data binding is automatic.(Inherited from BaseDataBoundControl.)

System_CAPS_protpropertyIsEnabled

Gets a value indicating whether the control is enabled.(Inherited from WebControl.)

System_CAPS_protpropertyIsTrackingViewState

Gets a value that indicates whether the server control is saving changes to its view state.(Inherited from Control.)

System_CAPS_protpropertyIsUsingModelBinders

When implemented in a derived class, gets a value that indicates whether the control is using model binders.(Inherited from BaseDataBoundControl.)

System_CAPS_protpropertyIsViewStateEnabled

Gets a value indicating whether view state is enabled for this control.(Inherited from Control.)

System_CAPS_pubpropertyItems

Gets a MenuItemCollection object that contains all menu items in the Menu control.

System_CAPS_pubpropertyItemWrap

Gets or sets a value indicating whether the text for menu items should wrap.

System_CAPS_pubpropertyLevelMenuItemStyles

Gets a MenuItemStyleCollection object that contains the style settings that are applied to menu items based on their level in a Menu control.

System_CAPS_pubpropertyLevelSelectedStyles

Gets a MenuItemStyleCollection object that contains the style settings that are applied to the selected menu item based on its level in a Menu control.

System_CAPS_pubpropertyLevelSubMenuStyles

Gets a MenuItemStyleCollection object that contains the style settings that are applied to the submenu items in the static menu based on their level in a Menu control.

System_CAPS_protpropertyLoadViewStateByID

Gets a value indicating whether the control participates in loading its view state by ID instead of index. (Inherited from Control.)

System_CAPS_pubpropertyMaximumDynamicDisplayLevels

Gets or sets the number of menu levels to render for a dynamic menu.

System_CAPS_pubpropertyNamingContainer

Gets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same Control.ID property value.(Inherited from Control.)

System_CAPS_pubpropertyOrientation

Gets or sets the direction in which to render the Menu control.

System_CAPS_pubpropertyPage

Gets a reference to the Page instance that contains the server control.(Inherited from Control.)

System_CAPS_pubpropertyParent

Gets a reference to the server control's parent control in the page control hierarchy.(Inherited from Control.)

System_CAPS_pubpropertyPathSeparator

Gets or sets the character used to delimit the path of a menu item in a Menu control.

System_CAPS_pubpropertyRenderingCompatibility

Gets a value that specifies the ASP.NET version that rendered HTML will be compatible with.(Inherited from Control.)

System_CAPS_pubpropertyRenderingMode

Gets or sets a value that specifies whether the Menu control renders HTML table elements and inline styles, or listitem elements and cascading style sheet (CSS) styles.

System_CAPS_protpropertyRequiresDataBinding

Gets or sets a value indicating whether the DataBind method should be called. (Inherited from BaseDataBoundControl.)

System_CAPS_pubpropertyScrollDownImageUrl

Gets or sets the URL to an image displayed in a dynamic menu to indicate that the user can scroll down for additional menu items.

System_CAPS_pubpropertyScrollDownText

Gets or sets the alternate text for the image specified in the ScrollDownImageUrl property.

System_CAPS_pubpropertyScrollUpImageUrl

Gets or sets the URL to an image displayed in a dynamic menu to indicate that the user can scroll up for additional menu items.

System_CAPS_pubpropertyScrollUpText

Gets or sets the alternate text for the image specified in the ScrollUpImageUrl property.

System_CAPS_pubpropertySelectedItem

Gets the selected menu item.

System_CAPS_pubpropertySelectedValue

Gets the value of the selected menu item.

System_CAPS_pubpropertySite

Gets information about the container that hosts the current control when rendered on a design surface.(Inherited from Control.)

System_CAPS_pubpropertySkinID

Gets or sets the skin to apply to the control.(Inherited from WebControl.)

System_CAPS_pubpropertySkipLinkText

Gets or sets the alternate text for a hidden image read by screen readers to provide the ability to skip the list of links.

System_CAPS_pubpropertyStaticBottomSeparatorImageUrl

Gets or sets the URL to an image displayed as the separator at the bottom of each static menu item.

System_CAPS_pubpropertyStaticDisplayLevels

Gets or sets the number of menu levels to display in a static menu.

System_CAPS_pubpropertyStaticEnableDefaultPopOutImage

Gets or sets a value indicating whether the built-in image is displayed to indicate that a static menu item has a submenu.

System_CAPS_pubpropertyStaticHoverStyle

Gets a reference to the Style object that allows you to set the appearance of a static menu item when the mouse pointer is positioned over it.

System_CAPS_pubpropertyStaticItemFormatString

Gets or sets additional text shown with all menu items that are statically displayed.

System_CAPS_pubpropertyStaticItemTemplate

Gets or sets the template that contains the custom content to render for a static menu.

System_CAPS_pubpropertyStaticMenuItemStyle

Gets a reference to the MenuItemStyle object that allows you to set the appearance of the menu items in a static menu.

System_CAPS_pubpropertyStaticMenuStyle

Gets a reference to the MenuItemStyle object that allows you to set the appearance of a static menu.

System_CAPS_pubpropertyStaticPopOutImageTextFormatString

Gets or sets the alternate text for the pop-out image used to indicate that a static menu item has a submenu.

System_CAPS_pubpropertyStaticPopOutImageUrl

Gets or sets the URL to an image displayed to indicate that a static menu item has a submenu.

System_CAPS_pubpropertyStaticSelectedStyle

Gets a reference to the MenuItemStyle object that allows you to set the appearance of the menu item selected by the user in a static menu.

System_CAPS_pubpropertyStaticSubMenuIndent

Gets or sets the amount of space, in pixels, to indent submenus within a static menu.

System_CAPS_pubpropertyStaticTopSeparatorImageUrl

Gets or sets the URL to an image displayed as the separator at the top of each static menu item.

System_CAPS_pubpropertyStyle

Gets a collection of text attributes that will be rendered as a style attribute on the outer tag of the Web server control.(Inherited from WebControl.)

System_CAPS_pubpropertySupportsDisabledAttribute

Gets a value that indicates whether the control should set the disabled attribute of the rendered HTML element to "disabled" when the control's IsEnabled property is false.(Inherited from BaseDataBoundControl.)

System_CAPS_pubpropertyTabIndex

Gets or sets the tab index of the Web server control.(Inherited from WebControl.)

System_CAPS_protpropertyTagKey

Gets the HtmlTextWriterTag value that corresponds to a Menu control. This property is used primarily by control developers.(Overrides WebControl.TagKey.)

System_CAPS_protpropertyTagName

Gets the name of the control tag. This property is used primarily by control developers.(Inherited from WebControl.)

System_CAPS_pubpropertyTarget

Gets or sets the target window or frame in which to display the Web page content associated with a menu item.

System_CAPS_pubpropertyTemplateControl

Gets or sets a reference to the template that contains this control. (Inherited from Control.)

System_CAPS_pubpropertyTemplateSourceDirectory

Gets the virtual directory of the Page or UserControl that contains the current server control.(Inherited from Control.)

System_CAPS_pubpropertyToolTip

Gets or sets the text displayed when the mouse pointer hovers over the Web server control.(Inherited from WebControl.)

System_CAPS_pubpropertyUniqueID

Gets the unique, hierarchically qualified identifier for the server control.(Inherited from Control.)

System_CAPS_pubpropertyValidateRequestMode

Gets or sets a value that indicates whether the control checks client input from the browser for potentially dangerous values.(Inherited from Control.)

System_CAPS_protpropertyViewState

Gets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page.(Inherited from Control.)

System_CAPS_protpropertyViewStateIgnoresCase

Gets a value that indicates whether the StateBag object is case-insensitive.(Inherited from Control.)

System_CAPS_pubpropertyViewStateMode

Gets or sets the view-state mode of this control.(Inherited from Control.)

System_CAPS_pubpropertyVisible

Gets or sets a value that indicates whether a server control is rendered as UI on the page.(Inherited from Control.)

System_CAPS_pubpropertyWidth

Gets or sets the width of the Web server control.(Inherited from WebControl.)

NameDescription
System_CAPS_protmethodAddAttributesToRender(HtmlTextWriter)

Adds HTML attributes and styles that need to be rendered to the specified HtmlTextWriter object.(Overrides WebControl.AddAttributesToRender(HtmlTextWriter).)

System_CAPS_protmethodAddedControl(Control, Int32)

Called after a child control is added to the Controls collection of the Control object.(Inherited from Control.)

System_CAPS_protmethodAddParsedSubObject(Object)

Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object.(Inherited from Control.)

System_CAPS_pubmethodApplyStyle(Style)

Copies any nonblank elements of the specified style to the Web control, overwriting any existing style elements of the control. This method is primarily used by control developers.(Inherited from WebControl.)

System_CAPS_pubmethodApplyStyleSheetSkin(Page)

Applies the style properties defined in the page style sheet to the control.(Inherited from Control.)

System_CAPS_protmethodBeginRenderTracing(TextWriter, Object)

Begins design-time tracing of rendering data.(Inherited from Control.)

System_CAPS_protmethodBuildProfileTree(String, Boolean)

This API supports the product infrastructure and is not intended to be used directly from your code. Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page.(Inherited from Control.)

System_CAPS_protmethodClearCachedClientID()

This API supports the product infrastructure and is not intended to be used directly from your code. Sets the cached ClientID value to null.(Inherited from Control.)

System_CAPS_protmethodClearChildControlState()

Deletes the control-state information for the server control's child controls. (Inherited from Control.)

System_CAPS_protmethodClearChildState()

Deletes the view-state and control-state information for all the server control's child controls.(Inherited from Control.)

System_CAPS_protmethodClearChildViewState()

Deletes the view-state information for all the server control's child controls.(Inherited from Control.)

System_CAPS_protmethodClearEffectiveClientIDMode()

This API supports the product infrastructure and is not intended to be used directly from your code. Sets the ClientIDMode property of the current control instance and of any child controls to Inherit.(Inherited from Control.)

System_CAPS_protmethodConfirmInitState()

Sets the initialized state of the data-bound control.(Inherited from BaseDataBoundControl.)

System_CAPS_pubmethodCopyBaseAttributes(WebControl)

Copies the properties not encapsulated by the Style object from the specified Web server control to the Web server control that this method is called from. This method is used primarily by control developers.(Inherited from WebControl.)

System_CAPS_protmethodCreateChildControls()

Creates the child controls of a Menu control.(Overrides Control.CreateChildControls().)

System_CAPS_protmethodCreateControlCollection()

Creates a new ControlCollection object to hold the child controls (both literal and server) of the server control.(Inherited from Control.)

System_CAPS_protmethodCreateControlStyle()

Creates the style object that is used internally by the WebControl class to implement all style related properties. This method is used primarily by control developers.(Inherited from WebControl.)

System_CAPS_pubmethodDataBind()

Binds the data source to the Menu control. This method cannot be inherited.(Overrides BaseDataBoundControl.DataBind().)

System_CAPS_protmethodDataBind(Boolean)

Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event. (Inherited from Control.)

System_CAPS_protmethodDataBindChildren()

Binds a data source to the server control's child controls.(Inherited from Control.)

System_CAPS_pubmethodDispose()

Enables a server control to perform final clean up before it is released from memory.(Inherited from Control.)

System_CAPS_protmethodEndRenderTracing(TextWriter, Object)

Ends design-time tracing of rendering data.(Inherited from Control.)

System_CAPS_protmethodEnsureChildControls()

Determines whether the server control contains child controls. If it does not, it creates child controls.(Inherited from Control.)

System_CAPS_protmethodEnsureDataBound()

Verifies that the menu control requires data binding and that a valid data source control is specified before calling the DataBind method.(Overrides BaseDataBoundControl.EnsureDataBound().)

System_CAPS_protmethodEnsureID()

Creates an identifier for controls that do not have an identifier assigned.(Inherited from Control.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodFindControl(String)

Searches the current naming container for a server control with the specified id parameter.(Inherited from Control.)

System_CAPS_protmethodFindControl(String, Int32)

This API supports the product infrastructure and is not intended to be used directly from your code. Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search. You should not override this version of the FindControl method.(Inherited from Control.)

System_CAPS_pubmethodFindItem(String)

Retrieves the menu item at the specified value path.

System_CAPS_pubmethodFocus()

Sets input focus to a control.(Inherited from Control.)

System_CAPS_protmethodGetData(String)

Retrieves a HierarchicalDataSourceView object that the data-bound control uses to perform data operations.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodGetDataSource()

Retrieves the IHierarchicalDataSource that the data-bound control is associated with, if any.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodGetDesignModeState()

Retrieves the design-time state of the Menu control.(Overrides Control.GetDesignModeState().)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetRouteUrl(Object)

Gets the URL that corresponds to a set of route parameters.(Inherited from Control.)

System_CAPS_pubmethodGetRouteUrl(RouteValueDictionary)

Gets the URL that corresponds to a set of route parameters.(Inherited from Control.)

System_CAPS_pubmethodGetRouteUrl(String, Object)

Gets the URL that corresponds to a set of route parameters and a route name.(Inherited from Control.)

System_CAPS_pubmethodGetRouteUrl(String, RouteValueDictionary)

Gets the URL that corresponds to a set of route parameters and a route name.(Inherited from Control.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodGetUniqueIDRelativeTo(Control)

Returns the prefixed portion of the UniqueID property of the specified control.(Inherited from Control.)

System_CAPS_pubmethodHasControls()

Determines if the server control contains any child controls.(Inherited from Control.)

System_CAPS_protmethodHasEvents()

Returns a value indicating whether events are registered for the control or any child controls.(Inherited from Control.)

System_CAPS_protmethodIsLiteralContent()

This API supports the product infrastructure and is not intended to be used directly from your code. Determines if the server control holds only literal content.(Inherited from Control.)

System_CAPS_protmethodLoadControlState(Object)

Loads the state of the properties in the Menu control that need to be persisted.(Overrides Control.LoadControlState(Object).)

System_CAPS_protmethodLoadViewState(Object)

Loads the previously saved view state of the Menu control.(Overrides WebControl.LoadViewState(Object).)

System_CAPS_protmethodMapPathSecure(String)

Retrieves the physical path that a virtual path, either absolute or relative, maps to.(Inherited from Control.)

System_CAPS_protmethodMarkAsDataBound()

Sets the state of the control in view state as successfully bound to data.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodMergeStyle(Style)

Copies any nonblank elements of the specified style to the Web control, but will not overwrite any existing style elements of the control. This method is used primarily by control developers.(Inherited from WebControl.)

System_CAPS_protmethodOnBubbleEvent(Object, EventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Determines whether the event for the Menu control is passed up the page's user interface (UI) server control hierarchy.(Overrides Control.OnBubbleEvent(Object, EventArgs).)

System_CAPS_protmethodOnDataBinding(EventArgs)

Raises the DataBinding event.(Overrides Control.OnDataBinding(EventArgs).)

System_CAPS_protmethodOnDataBound(EventArgs)

Raises the DataBound event.(Inherited from BaseDataBoundControl.)

System_CAPS_protmethodOnDataPropertyChanged()

Called when one of the base data source identification properties is changed, to re-bind the data-bound control to its data.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodOnDataSourceChanged(Object, EventArgs)

Called when the IHierarchicalDataSource instance that the data-bound control works with raises the DataSourceChanged event.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodOnInit(EventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the Init event.(Overrides BaseDataBoundControl.OnInit(EventArgs).)

System_CAPS_protmethodOnLoad(EventArgs)

Handles the Load event.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodOnMenuItemClick(MenuEventArgs)

Raises the MenuItemClick event.

System_CAPS_protmethodOnMenuItemDataBound(MenuEventArgs)

Raises the MenuItemDataBound event.

System_CAPS_protmethodOnPagePreLoad(Object, EventArgs)

Sets the initialized state of the data-bound control before the control is loaded.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodOnPreRender(EventArgs)

This API supports the product infrastructure and is not intended to be used directly from your code. Raises the PreRender event.(Overrides BaseDataBoundControl.OnPreRender(EventArgs).)

System_CAPS_protmethodOnUnload(EventArgs)

Raises the Unload event.(Inherited from Control.)

System_CAPS_protmethodOpenFile(String)

Gets a Stream used to read a file.(Inherited from Control.)

System_CAPS_protmethodPerformDataBinding()

This API supports the product infrastructure and is not intended to be used directly from your code. Binds the items from the data source to the menu items in the Menu control.(Overrides HierarchicalDataBoundControl.PerformDataBinding().)

System_CAPS_protmethodPerformSelect()

Retrieves data from the associated data source.(Inherited from HierarchicalDataBoundControl.)

System_CAPS_protmethodRaiseBubbleEvent(Object, EventArgs)

Assigns any sources of the event and its information to the control's parent.(Inherited from Control.)

System_CAPS_protmethodRaisePostBackEvent(String)

Processes an event raised when a form is posted to the server.

System_CAPS_protmethodRemovedControl(Control)

Called after a child control is removed from the Controls collection of the Control object.(Inherited from Control.)

System_CAPS_protmethodRender(HtmlTextWriter)

This API supports the product infrastructure and is not intended to be used directly from your code. Renders the menu control on the client browser.(Overrides WebControl.Render(HtmlTextWriter).)

System_CAPS_pubmethodRenderBeginTag(HtmlTextWriter)

Adds tag attributes and writes the markup for the opening tag of the control to the output stream emitted to the browser or device.(Overrides WebControl.RenderBeginTag(HtmlTextWriter).)

System_CAPS_protmethodRenderChildren(HtmlTextWriter)

Outputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client.(Inherited from Control.)

System_CAPS_protmethodRenderContents(HtmlTextWriter)

This API supports the product infrastructure and is not intended to be used directly from your code. This member overrides RenderContents.(Overrides WebControl.RenderContents(HtmlTextWriter).)

System_CAPS_pubmethodRenderControl(HtmlTextWriter)

Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled.(Inherited from Control.)

System_CAPS_protmethodRenderControl(HtmlTextWriter, ControlAdapter)

Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object.(Inherited from Control.)

System_CAPS_pubmethodRenderEndTag(HtmlTextWriter)

Performs final markup and writes the HTML closing tag of the control to the output stream emitted to the browser or device.(Overrides WebControl.RenderEndTag(HtmlTextWriter).)

System_CAPS_protmethodResolveAdapter()

Gets the control adapter responsible for rendering the specified control.(Inherited from Control.)

System_CAPS_pubmethodResolveClientUrl(String)

Gets a URL that can be used by the browser.(Inherited from Control.)

System_CAPS_pubmethodResolveUrl(String)

Converts a URL into one that is usable on the requesting client.(Inherited from Control.)

System_CAPS_protmethodSaveControlState()

This API supports the product infrastructure and is not intended to be used directly from your code. Saves the state of the properties in the Menu control that need to be persisted.(Overrides Control.SaveControlState().)

System_CAPS_protmethodSaveViewState()

Saves the state of the Menu control.(Overrides WebControl.SaveViewState().)

System_CAPS_protmethodSetDesignModeState(IDictionary)

Sets design-time data for the Menu control.(Overrides Control.SetDesignModeState(IDictionary).)

System_CAPS_protmethodSetItemDataBound(MenuItem, Boolean)

Sets the DataBound property of the specified MenuItem object with the specified value.

System_CAPS_protmethodSetItemDataItem(MenuItem, Object)

Sets the DataItem property of the specified MenuItem object with the specified value.

System_CAPS_protmethodSetItemDataPath(MenuItem, String)

Sets the DataPath property of the specified MenuItem object with the specified value.

System_CAPS_pubmethodSetRenderMethodDelegate(RenderMethod)

This API supports the product infrastructure and is not intended to be used directly from your code. Assigns an event handler delegate to render the server control and its content into its parent control.(Inherited from Control.)

System_CAPS_pubmethodSetTraceData(Object, Object)

Sets trace data for design-time tracing of rendering data, using the trace data key and the trace data value.(Inherited from Control.)

System_CAPS_pubmethodSetTraceData(Object, Object, Object)

Sets trace data for design-time tracing of rendering data, using the traced object, the trace data key, and the trace data value.(Inherited from Control.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_protmethodTrackViewState()

Tracks view-state changes to the Menu control so they can be stored in the control's StateBag object. This object is accessible through the ViewState property.(Overrides WebControl.TrackViewState().)

System_CAPS_protmethodValidateDataSource(Object)

Verifies that the object a data-bound control binds to is one it can work with.(Inherited from HierarchicalDataBoundControl.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticMenuItemClickCommandName

Contains the command name.

NameDescription
System_CAPS_pubeventDataBinding

Occurs when the server control binds to a data source.(Inherited from Control.)

System_CAPS_pubeventDataBound

Occurs after the server control binds to a data source.(Inherited from BaseDataBoundControl.)

System_CAPS_pubeventDisposed

Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested.(Inherited from Control.)

System_CAPS_pubeventInit

Occurs when the server control is initialized, which is the first step in its lifecycle.(Inherited from Control.)

System_CAPS_pubeventLoad

Occurs when the server control is loaded into the Page object.(Inherited from Control.)

System_CAPS_pubeventMenuItemClick

Occurs when a menu item in a Menu control is clicked.

System_CAPS_pubeventMenuItemDataBound

Occurs when a menu item in a Menu control is bound to data.

System_CAPS_pubeventPreRender

Occurs after the Control object is loaded but prior to rendering.(Inherited from Control.)

System_CAPS_pubeventUnload

Occurs when the server control is unloaded from memory.(Inherited from Control.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIAttributeAccessor.GetAttribute(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Gets an attribute of the Web control with the specified name.(Inherited from WebControl.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAttributeAccessor.SetAttribute(String, String)

Sets an attribute of the Web control to the specified name and value.(Inherited from WebControl.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIControlDesignerAccessor.GetDesignModeState()

For a description of this member, see IControlDesignerAccessor.GetDesignModeState.(Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIControlDesignerAccessor.SetDesignModeState(IDictionary)

For a description of this member, see IControlDesignerAccessor.SetDesignModeState. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIControlDesignerAccessor.SetOwnerControl(Control)

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IControlDesignerAccessor.SetOwnerControl. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIParserAccessor.AddParsedSubObject(Object)

For a description of this member, see IParserAccessor.AddParsedSubObject. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIPostBackEventHandler.RaisePostBackEvent(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Processes an event raised when a form is posted to the server.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIControlBuilderAccessor.ControlBuilder

For a description of this member, see IControlBuilderAccessor.ControlBuilder. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIControlDesignerAccessor.UserData

For a description of this member, see IControlDesignerAccessor.UserData. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIDataBindingsAccessor.DataBindings

For a description of this member, see IDataBindingsAccessor.DataBindings. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIDataBindingsAccessor.HasDataBindings

For a description of this member, see IDataBindingsAccessor.HasDataBindings. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIExpressionsAccessor.Expressions

For a description of this member, see IExpressionsAccessor.Expressions. (Inherited from Control.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIExpressionsAccessor.HasExpressions

For a description of this member, see IExpressionsAccessor.HasExpressions. (Inherited from Control.)

NameDescription
System_CAPS_pubmethodEnableDynamicData(Type)

Overloaded. Enables Dynamic Data behavior for the specified data control.(Defined by DataControlExtensions.)

System_CAPS_pubmethodEnableDynamicData(Type, IDictionary<String, Object>)

Overloaded. Enables Dynamic Data behavior for the specified data control.(Defined by DataControlExtensions.)

System_CAPS_pubmethodEnableDynamicData(Type, Object)

Overloaded. Enables Dynamic Data behavior for the specified data control.(Defined by DataControlExtensions.)

System_CAPS_pubmethodEnablePersistedSelection()

Obsolete.Enables selection to be persisted in data controls that support selection and paging.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodFindDataSourceControl()

Returns the data source that is associated with the data control for the specified control.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodFindFieldTemplate(String)

Returns the field template for the specified column in the specified control's naming container.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodFindMetaTable()

Returns the metatable object for the containing data control.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodGetDefaultValues()

Overloaded. Gets the collection of the default values for the specified data control.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodGetMetaTable()

Overloaded. Gets the table metadata for the specified data control.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodSetMetaTable(MetaTable)

Overloaded. Sets the table metadata for the specified data control.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodSetMetaTable(MetaTable, IDictionary<String, Object>)

Overloaded. Sets the table metadata and default value mapping for the specified data control.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodSetMetaTable(MetaTable, Object)

Overloaded. Sets the table metadata and default value mapping for the specified data control.(Defined by DynamicDataExtensions.)

System_CAPS_pubmethodTryGetMetaTable(MetaTable)

Overloaded. Determines whether table metadata is available.(Defined by DynamicDataExtensions.)

The Menu control is used to display a menu in an ASP.NET Web page and is often used in combination with a SiteMapDataSource control for navigating a Web site. The Menu control supports the following features:

  • Data binding that allows the control's menu items to be bound to hierarchal data sources.

  • Site navigation through integration with the SiteMapDataSource control.

  • Programmatic access to the Menu object model to dynamically create menus, populate menu items, set properties, and so on.

  • Customizable appearance through themes, user-defined images, styles, and user-defined templates.

When the user clicks a menu item, the Menu control can either navigate to a linked Web page or simply post back to the server. If the NavigateUrl property of a menu item is set, the Menu control navigates to the linked page; otherwise, it posts the page back to the server for processing. By default, a linked page is displayed in the same window or frame as the Menu control. To display the linked content in a different window or frame, use the Target property of the Menu control.

System_CAPS_noteNote

The Target property affects every menu item in the control. To specify a window or frame for an individual menu item, set the Target property of the MenuItem object directly.

The Menu control displays two types of menus: a static menu and a dynamic menu. The static menu is always displayed in a Menu control. By default, the menu items at the root level (level 0) are displayed in the static menu. You can display additional menu levels (static submenus) within the static menu by setting the StaticDisplayLevels property. Menu items (if any) with a higher level than the value specified by the StaticDisplayLevels property are displayed in a dynamic menu. A dynamic menu appears only when the user positions the mouse pointer over the parent menu item that contains a dynamic submenu. Dynamic menus automatically disappear after a certain duration. Use the DisappearAfter property to specify the duration.

System_CAPS_noteNote

A dynamic menu also disappears when the user clicks outside of the menu.

You can also limit the number of levels displayed in a dynamic menu by setting the MaximumDynamicDisplayLevels property. Menu levels higher than the specified value are discarded.

System_CAPS_noteNote

The Menu control is not designed to be used inside an UpdatePanel control. You can add the Menu control only to a page outside an UpdatePanel control. UpdatePanel controls are used to update selected regions of a page instead of updating the whole page with a postback. For more information, see UpdatePanel Control Overview and Partial-Page Rendering Overview.

A Menu control is made up of a tree of menu items represented by MenuItem objects. Menu items at the top level (level 0) are called root menu items. A menu item that has a parent menu item is called a child menu item. All root menu items are stored in the Items collection. Child menu items are stored in a parent menu item's ChildItems collection.

Each menu item has a Text and a Value property. The value of the Text property is displayed in the Menu control, while the Value property is used to store any additional data about the menu item, such as data passed to the postback event associated with the menu item. When clicked, a menu item can navigate to another Web page indicated by the NavigateUrl property.

System_CAPS_noteNote

If the NavigateUrl property is not set for a menu item, the Menu control simply submits the page to the server for processing when the menu item is clicked.

You can also optionally display an image in a menu item by setting the ImageUrl property.

For more information on menu items, see MenuItem.

The simplest data model of the Menu control is static menu items. To display static menu items using declarative syntax, first nest opening and closing <Items> tags between the opening and closing tags of the Menu control. Next, create the menu structure by nesting <asp:MenuItem> elements between the opening and closing <Items> tags. Each <asp:MenuItem> element represents a menu item in the control and maps to a MenuItem object. You can set the properties of each menu item by setting the attributes of its <asp:MenuItem> element. To create submenu items, nest additional <asp:MenuItem> elements between the opening and closing <asp:MenuItem> tags of the parent menu item.

The Menu control can use any hierarchal data source control, such as an XmlDataSource control or a SiteMapDataSource control. To bind to a hierarchal data source control, set the DataSourceID property of the Menu control to the ID value of the data source control. The Menu control automatically binds to the specified data source control. This is the preferred method to bind to data.

When binding to a data source where each data item contains multiple properties (such as an XML element with several attributes), a menu item displays the value returned by the ToString method of the data item by default. In the case of an XML element, the menu item displays the element name, which shows the underlying structure of the menu tree but is not very useful otherwise. You can bind a menu item to a specific data item property by using the DataBindings collection to specify menu item bindings. The DataBindings collection contains MenuItemBinding objects that define the relationship between a data item and the menu item it is binding to. You can specify the criteria for binding and the data item property to display in the node. For more information on menu item bindings, see MenuItemBinding.

You cannot create empty nodes in a Menu control by setting the Text or TextField properties to the empty string (""). Setting these properties to the empty string has the same effect as not setting the properties. In that case, the Menu control creates a default binding using the DataSource property. For more information, see Binding to Databases.

There are many ways to customize the appearance of the Menu control. First, you can specify whether the Menu control is rendered horizontally or vertically by setting the Orientation property. You can also specify a different style (such as font size and color) for each of the menu item types.

If you use cascading style sheets (CSS) to customize the appearance of the control, use either inline styles or a separate CSS file, but not both. Using both inline styles and a separate CSS file could cause unexpected results. For more information on using style sheets with controls, see ASP.NET Web Server Controls and CSS Styles.

The following table lists the available menu item styles.

Menu item style property

Description

DynamicHoverStyle

The style settings for a dynamic menu item when the mouse pointer is positioned over it.

DynamicMenuItemStyle

The style settings for an individual dynamic menu item.

DynamicMenuStyle

The style settings for a dynamic menu.

DynamicSelectedStyle

The style settings for the currently selected dynamic menu item.

StaticHoverStyle

The style settings for a static menu item when the mouse pointer is positioned over it.

StaticMenuItemStyle

The style settings for an individual static menu item.

StaticMenuStyle

The style settings for a static menu.

StaticSelectedStyle

The style settings for the currently selected static menu item.

Instead of setting the individual style properties, you can specify styles that are applied to menu items based on their level by using the following style collections.

Level style collections

Description

LevelMenuItemStyles

A collection of MenuItemStyle objects that control the style of the menu items on a level basis.

LevelSelectedStyles

A collection of MenuItemStyle objects that control the style of selected menu items on a level basis.

LevelSubMenuStyles

A collection of MenuItemStyle objects that control the style of the submenu items on a level basis.

The first style in the collection corresponds to the style of the menu items at the first depth level in the menu tree. The second style in the collection corresponds to the style of the menu items at the second depth level in the menu tree, and so on. This is most often used to generate table of contents-style navigation menus where menu items at a certain depth should have the same appearance, regardless of whether they have submenus.

System_CAPS_noteNote

If you use any of the level style collections listed in the previous table to define the style for the Menu control, these style settings override the individual menu item style properties.

Another way to alter the appearance of the control is to customize the images displayed in the Menu control. You can specify your own custom image for the different parts of the control by setting the properties shown in the following table.

Image property

Description

DynamicBottomSeparatorImageUrl

An optional image displayed at the bottom of a dynamic menu item to separate it from other menu items.

DynamicPopOutImageUrl

An optional image displayed in a dynamic menu item to indicate that it has a submenu.

DynamicTopSeparatorImageUrl

An optional image displayed at the top of a dynamic menu item to separate it from other menu items.

ScrollDownImageUrl

The image displayed at the bottom of a menu item to indicate that the user can scroll down to view additional menu items.

ScrollUpImageUrl

The image displayed at the top of a menu item to indicate that the user can scroll up to view additional menu items.

StaticBottomSeparatorImageUrl

An optional image displayed at the bottom of a static menu item to separate it from other menu items.

StaticPopOutImageUrl

An optional image displayed in a static menu item to indicate that it has a submenu.

StaticTopSeparatorImageUrl

An optional image displayed at the top of a static menu item to separate it from other menu items.

For complete control of the user interface (UI), you can define your own custom templates for the Menu control using the following template properties.

Template property

Description

DynamicItemTemplate

The template that contains the custom content to render for a dynamic menu item.

StaticItemTemplate

The template that contains the custom content to render for a static menu item.

You can control the vertical and horizontal position of a dynamic menu relative to its parent menu item by setting the DynamicVerticalOffset and DynamicHorizontalOffset properties, respectively. To control the indentation of the static submenu items within a static menu, use the StaticSubMenuIndent property.

The Menu control provides several events that you can program against. This allows you to run a custom routine whenever an event occurs. The following table lists the supported events.

Event

Description

MenuItemClick

Occurs when a menu item is clicked. This event is commonly used to synchronize a Menu control with another control on the page.

MenuItemDataBound

Occurs when a menu item is bound to data. This event is commonly used to modify a menu item before it is rendered in a Menu control.

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio and ASP.NET and ASP.NET Controls and Accessibility.

<asp:Menu
    AccessKey="string"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
        Inset|Outset"
    BorderWidth="size"
    CssClass="string"
    DataSource="string"
    DataSourceID="string"
    DisappearAfter="integer"
    DynamicBottomSeparatorImageUrl="uri"
    DynamicEnableDefaultPopOutImage="True|False"
    DynamicHorizontalOffset="integer"
    DynamicItemFormatString="string"
    DynamicPopOutImageTextFormatString="string"
    DynamicPopOutImageUrl="uri"
    DynamicTopSeparatorImageUrl="uri"
    DynamicVerticalOffset="integer"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
        Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    Height="size"
    ID="string"
    ItemWrap="True|False"
    MaximumDynamicDisplayLevels="integer"
    OnDataBinding="DataBinding event handler"
    OnDataBound="DataBound event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnMenuItemClick="MenuItemClick event handler"
    OnMenuItemDataBound="MenuItemDataBound event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    Orientation="Horizontal|Vertical"
    PathSeparator="string"
    runat="server"
    ScrollDownImageUrl="uri"
    ScrollDownText="string"
    ScrollUpImageUrl="uri"
    ScrollUpText="string"
    SkinID="string"
    SkipLinkText="string"
    StaticBottomSeparatorImageUrl="uri"
    StaticDisplayLevels="integer"
    StaticEnableDefaultPopOutImage="True|False"
    StaticItemFormatString="string"
    StaticPopOutImageTextFormatString="string"
    StaticPopOutImageUrl="uri"
    StaticSubMenuIndent="size"
    StaticTopSeparatorImageUrl="uri"
    Style="string"
    TabIndex="integer"
    Target="string"
    ToolTip="string"
    Visible="True|False"
    Width="size"
>
        <DataBindings>
                <asp:MenuItemBinding
                    DataMember="string"
                    Depth="integer"
                    Enabled="True|False"
                    EnabledField="string"
                    FormatString="string"
                    ImageUrl="uri"
                    ImageUrlField="string"
                    NavigateUrl="uri"
                    NavigateUrlField="string"
                    PopOutImageUrl="uri"
                    PopOutImageUrlField="string"
                    Selectable="True|False"
                    SelectableField="string"
                    SeparatorImageUrl="uri"
                    SeparatorImageUrlField="string"
                    Target="string"
                    TargetField="string"
                    Text="string"
                    TextField="string"
                    ToolTip="string"
                    ToolTipField="string"
                    Value="string"
                    ValueField="string"
                />
        </DataBindings>
        <DynamicHoverStyle />
        <DynamicItemTemplate>
            <!-- child controls -->
        </DynamicItemTemplate>
        <DynamicMenuItemStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|
                Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            Font-Bold="True|False"
            Font-Italic="True|False"
            Font-Names="string"
            Font-Overline="True|False"
            Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|
                Medium|Large|X-Large|XX-Large"
            Font-Strikeout="True|False"
            Font-Underline="True|False"
            ForeColor="color name|#dddddd"
            Height="size"
            HorizontalPadding="size"
            ItemSpacing="size"
            OnDisposed="Disposed event handler"
            VerticalPadding="size"
            Width="size"
        />
        <DynamicMenuStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|
                Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            Font-Bold="True|False"
            Font-Italic="True|False"
            Font-Names="string"
            Font-Overline="True|False"
            Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|
                Medium|Large|X-Large|XX-Large"
            Font-Strikeout="True|False"
            Font-Underline="True|False"
            ForeColor="color name|#dddddd"
            Height="size"
            HorizontalPadding="size"
            OnDisposed="Disposed event handler"
            VerticalPadding="size"
            Width="size"
        />
        <DynamicSelectedStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|
                Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            Font-Bold="True|False"
            Font-Italic="True|False"
            Font-Names="string"
            Font-Overline="True|False"
            Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|
                Medium|Large|X-Large|XX-Large"
            Font-Strikeout="True|False"
            Font-Underline="True|False"
            ForeColor="color name|#dddddd"
            Height="size"
            HorizontalPadding="size"
            ItemSpacing="size"
            OnDisposed="Disposed event handler"
            VerticalPadding="size"
            Width="size"
        />
        <Items />
        <LevelMenuItemStyles>
                <asp:MenuItemStyle
                    BackColor="color name|#dddddd"
                    BorderColor="color name|#dddddd"
                    BorderStyle="NotSet|None|Dotted|Dashed|Solid|
                        Double|Groove|Ridge|Inset|Outset"
                    BorderWidth="size"
                    CssClass="string"
                    Font-Bold="True|False"
                    Font-Italic="True|False"
                    Font-Names="string"
                    Font-Overline="True|False"
                    Font-Size="string|Smaller|Larger|XX-Small|
                        X-Small|Small|Medium|Large|X-Large|XX-Large"
                    Font-Strikeout="True|False"
                    Font-Underline="True|False"
                    ForeColor="color name|#dddddd"
                    Height="size"
                    HorizontalPadding="size"
                    ItemSpacing="size"
                    OnDisposed="Disposed event handler"
                    VerticalPadding="size"
                    Width="size"
                />
        </LevelMenuItemStyles>
        <LevelSelectedStyles>
                <asp:MenuItemStyle
                    BackColor="color name|#dddddd"
                    BorderColor="color name|#dddddd"
                    BorderStyle="NotSet|None|Dotted|Dashed|Solid|
                        Double|Groove|Ridge|Inset|Outset"
                    BorderWidth="size"
                    CssClass="string"
                    Font-Bold="True|False"
                    Font-Italic="True|False"
                    Font-Names="string"
                    Font-Overline="True|False"
                    Font-Size="string|Smaller|Larger|XX-Small|
                        X-Small|Small|Medium|Large|X-Large|XX-Large"
                    Font-Strikeout="True|False"
                    Font-Underline="True|False"
                    ForeColor="color name|#dddddd"
                    Height="size"
                    HorizontalPadding="size"
                    ItemSpacing="size"
                    OnDisposed="Disposed event handler"
                    VerticalPadding="size"
                    Width="size"
                />
        </LevelSelectedStyles>
        <LevelSubMenuStyles>
                <asp:SubMenuStyle
                    BackColor="color name|#dddddd"
                    BorderColor="color name|#dddddd"
                    BorderStyle="NotSet|None|Dotted|Dashed|Solid|
                        Double|Groove|Ridge|Inset|Outset"
                    BorderWidth="size"
                    CssClass="string"
                    Font-Bold="True|False"
                    Font-Italic="True|False"
                    Font-Names="string"
                    Font-Overline="True|False"
                    Font-Size="string|Smaller|Larger|XX-Small|
                        X-Small|Small|Medium|Large|X-Large|XX-Large"
                    Font-Strikeout="True|False"
                    Font-Underline="True|False"
                    ForeColor="color name|#dddddd"
                    Height="size"
                    HorizontalPadding="size"
                    OnDisposed="Disposed event handler"
                    VerticalPadding="size"
                    Width="size"
                />
        </LevelSubMenuStyles>
        <StaticHoverStyle />
        <StaticItemTemplate>
            <!-- child controls -->
        </StaticItemTemplate>
        <StaticMenuItemStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|
                Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            Font-Bold="True|False"
            Font-Italic="True|False"
            Font-Names="string"
            Font-Overline="True|False"
            Font-Size="string|Smaller|Larger|XX-Small|
                X-Small|Small|Medium|Large|X-Large|XX-Large"
            Font-Strikeout="True|False"
            Font-Underline="True|False"
            ForeColor="color name|#dddddd"
            Height="size"
            HorizontalPadding="size"
            ItemSpacing="size"
            OnDisposed="Disposed event handler"
            VerticalPadding="size"
            Width="size"
        />
        <StaticMenuStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|
                Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            Font-Bold="True|False"
            Font-Italic="True|False"
            Font-Names="string"
            Font-Overline="True|False"
            Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|
                Medium|Large|X-Large|XX-Large"
            Font-Strikeout="True|False"
            Font-Underline="True|False"
            ForeColor="color name|#dddddd"
            Height="size"
            HorizontalPadding="size"
            OnDisposed="Disposed event handler"
            VerticalPadding="size"
            Width="size"
        />
        <StaticSelectedStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|
                Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            Font-Bold="True|False"
            Font-Italic="True|False"
            Font-Names="string"
            Font-Overline="True|False"
            Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|
                Medium|Large|X-Large|XX-Large"
            Font-Strikeout="True|False"
            Font-Underline="True|False"
            ForeColor="color name|#dddddd"
            Height="size"
            HorizontalPadding="size"
            ItemSpacing="size"
            OnDisposed="Disposed event handler"
            VerticalPadding="size"
            Width="size"
        />
</asp:Menu>

A Visual Studio Web site project with source code is available to accompany this topic: Download.

The following code example demonstrates how to create a Menu control with static menu items using declarative syntax.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu Declarative Example</title>
</head>

  <body>
    <form id="form1" runat="server">

      <h3>Menu Declarative Example</h3>

      <!-- Use declarative syntax to create the   -->
      <!-- menu structure. Submenu items are      -->
      <!-- created by nesting them in parent menu -->
      <!-- items.                                 -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"  
        runat="server">

        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>

        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>

      </asp:menu>

    </form>
  </body>
</html>

The following code example demonstrates how to bind the Menu control to a SiteMapDataSource control. For this example to work correctly, you must copy the sample site map data below to a file named Web.sitemap.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu DataBinding Example</title>
</head>

  <body>
    <form id="form1" runat="server">

      <h3>Menu DataBinding Example</h3>

      <!-- Bind the Menu control to a SiteMapDataSource control.  -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"
        datasourceid="MenuSource"   
        runat="server">

        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>

      </asp:menu>

      <asp:SiteMapDataSource id="MenuSource"
        runat="server"/>        

    </form>
  </body>
</html>

The following is sample site map data for the previous example.

<siteMap>
  <siteMapNode url="~\Home.aspx" 
    title="Home"
    description="Home">
    <siteMapNode url="~\Music.aspx"
      title="Music"
      description="Music">
      <siteMapNode url="~\Classical.aspx" 
        title="Classical"
        description="Classical"/>
      <siteMapNode url="~\Rock.aspx"
        title="Rock"
        description="Rock"/>
      <siteMapNode url="~\Jazz.aspx"
        title="Jazz"
        description="Jazz"/>
    </siteMapNode>
    <siteMapNode url="~\Movies.aspx"
      title="Movies"
      description="Movies">
      <siteMapNode url="~\Action.aspx"
        title="Action"
        description="Action"/>
      <siteMapNode url="~\Drama.aspx"
        title="Drama"
        description="Drama"/>
      <siteMapNode url="~\Musical.aspx"
        title="Musical"
        description="Musical"/>
    </siteMapNode>
  </siteMapNode>
</siteMap>

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: