System.Web.UI.WebControls Namespace MenuItem Class
.NET Framework version 2.0
Sets or retrieves the text displayed for a MenuItem in a Menu control.
Inline |
<asp:menuitem text = strtext ... > |
Script |
MenuItem.Text [ = strtext ] |
strtext |
String that specifies the text displayed for a menu item in a Menu control. |
The property is read/write with no default value.
Use the Text property to specify or determine the text to display for a MenuItem in a Menu control.
In certain cases, such as when a Menu control is bound to a data source, the Text property is usually obtained dynamically from the data source.
The following example shows how to declaratively set the Text property of menu items at design time.
Show me
The following example shows how to programmatically set the Text property of menu items at run time.
Show me
The following example demonstrates how to programmatically determine the given Text for a menu item and its parent, when the user selects an item from a Menu control.
Note that this example merely serves to illustrate the concept. If all you need is to determine the selected menu item's Text, simply use the SelectedItem.Text property to accomplish the same, without having to code a handler for the MenuItemClick event.
Show me
MenuItem Members Value SelectedValue