Defines the relationship between a data item and the menu item it is binding to in a Menu control. This class cannot be inherited.
Assembly: System.Web (in System.Web.dll)
Gets or sets the data member to bind to a menu item.
Gets or sets the menu depth to which theobject is applied.
Gets or sets a value that indicates whether the menu item to which theobject is applied is enabled, allowing the item to display a pop-out image and any child menu items.
Gets or sets the string that specifies the display format for the text of a menu item to which theobject is applied.
Gets or sets the URL to an image that is displayed next to the text of a menu item to which theobject is applied.
Gets or sets the URL to link to when a menu item to which theobject is applied is clicked.
Gets or sets the URL to an image that indicates the presence of a dynamic submenu for a menu item to which theobject is applied.
Gets or sets a value that indicates whether the menu item to which theobject is applied can be selected, or is "clickable."
Gets or sets the URL to an image displayed below the text of a menu item (to separate it from other menu items) for a menu item to which theobject is applied.
Gets or sets the target window or frame in which to display the Web page content associated with a menu item to which theobject is applied.
Gets or sets the text displayed for the menu item to which theobject is applied.
Gets or sets the ToolTip text for a menu item to which theobject is applied.
Gets or sets a nondisplayed value used to store any additional data about a menu item to which theobject is applied, such as data used for handling postback events.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Returns a string that represents the current object.(Overrides Object.ToString().)
This API supports the product infrastructure and is not intended to be used directly from your code. Creates a copy of theobject.
Loads the node's previously saved view state.
This API supports the product infrastructure and is not intended to be used directly from your code. Saves the view state changes to an Object.
This API supports the product infrastructure and is not intended to be used directly from your code. Instructs theobject to track changes to its view state.
For a description of this member, see DataSourceViewSchema.
This API supports the product infrastructure and is not intended to be used directly from your code. Gets a value that indicates whether theobject is saving changes to its view state.
When the Menu control is bound to a data source where each data item contains multiple fields (such as an XML element with several attributes), if no menu item bindings are defined, 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, but is not very useful otherwise. You can bind the properties of a menu item to a specific field by specifying menu item bindings. A object defines the relationship between each data item and the menu item it is binding to.
The Menu control stores its objects in the DataBindings property and applies the bindings to the data source to create a one-to-one relationship between the menu hierarchy and the data source hierarchy. For each data item in the data source, the Menu control attempts to match the data item to a object to create the corresponding MenuItem object.
<asp:MenuItemBinding Depth="0" TextField="Name" ValueField="ID">
A data member specifies the type of the data item in the underlying data source, but can represent different information depending on the data source. Each data item in a hierarchical data source (represented by an IHierarchyData object) exposes a Type property, which specifies the type of the data item. For example, the data member for an XML element specifies the name of the element. When a data source contains multiple data item types, the data member specifies which data item type to use. The following declaration binds the <Book> elements of an XmlDataSource control to all the menu items in the menu, regardless of the location in the hierarchy:
<asp:MenuItemBinding DataMember="Book" TextField="Title" ValueField= "ISBN">
Sometimes you might need to create a menu item binding that specifies both a depth and a data member. This is often used when the data source contains items at different levels that have the same data member value. For example, you can have <Item> elements that appear at different levels within an XML file. The following declarations show how to specify menu item bindings that apply to identical data members at different menu depths:
<asp:MenuItemBinding DataMember="Item" Depth="1" TextField="Title">
<asp:MenuItemBinding DataMember="Item" Depth="2" TextField="ISBN">
If a menu item binding is defined without a depth and a data member, the menu item binding is applied to all menu items within the menu. This is commonly used when all data items have the same properties and should be displayed identically, regardless of the menu depth.
After the binding criteria are established, you can then bind a property of a MenuItem object that can be bound to a value. You can bind to a field of a data item or to a static value. When bound to a static value, all MenuItem objects to which the object is applied share the same value. Properties bound to fields contain the values of the corresponding field from the data source.
You can selectively override a bound property in a MenuItem object by setting the corresponding property directly.
The following table lists the properties of the MenuItem object to a field of a data item.class that allow you to bind a property of the
The following table lists the properties of the MenuItem object to a static value.class that allow you to bind a property of the
If conflicting Menu control applies the menu item bindings in the following order of precedence:objects are defined, the
Theobject that defines and matches both a depth and a data member.
Theobject that defines and matches the data member only.
Theobject that defines and matches the depth only.
Theobject that defines neither the depth nor the data member. (This type of menu item binding is applied to all menu items in the menu.)
The FormatString property.class also allows you to format the text displayed in a menu item by setting the
The following code example demonstrates how to use XmlDataSource control and the menu items in a Menu control. For this example to work correctly, you must copy the sample XML data below to a file named Menu.xml.objects to define the relationship between the fields of an
The following code is sample site map data for the previous example.
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.