System.Web.UI.WebControls Namespace Menu Class
.NET Framework version 2.0
Returns the value of the selected menu item in a Menu control.
Script |
[ String strValue = ] Menu.SelectedValue |
This property can only be used programmatically; it cannot be set when declaring the control.
strValue |
The value of the selected menu item in a Menu control. |
The property is read only with no default value.
Use the SelectedValue property to determine the value of the selected menu item in a Menu control.
This property simply returns the value of the Value property of the MenuItem object that is referred to by the SelectedItem property ( SelectedItem.Value ).
If no Value is specified for the menu item, this property returns the value of the selected menu item's Text property. If the Text property in turn contains a null reference, or if no menu item is currently selected in the Menu control, an empty string ( "" ) is returned.
To access other properties of the selected menu item, though, such as Parent or Depth, you still need to use the SelectedItem property.
The following example demonstrates how to use the SelectedValue property to determine the value of the selected menu item in a Menu control.
Show me
Menu Members SelectedItem Text Value