System.Web.UI.WebControls Namespace MenuItem Class
.NET Framework version 2.0
Sets or retrieves the destination of the MenuItem control.
Inline |
<asp:menuitem navigateurl = strUrl ... > |
Script |
MenuItem.NavigateUrl [ = strUrl ] |
strUrl |
String specifying the URL to link to when the menuitem is clicked. |
The property is read/write with no default value.
Use the NavigateUrl property to specify or determine the URL to navigate to when the MenuItem control is clicked.
A menu item can be in one of two modes: selection mode or navigation mode. A menu item is in navigation mode when the NavigateUrl property for the node is set to a value other than an empty string. Otherwise, the node is in selection mode, wherein the user can select a node by clicking on the node text.
When a menu item is in navigation mode, all selection events are disabled for that menu item. Clicking the menu item in navigation mode takes the user to the specified URL.
By default, the linked content is opened in the current window or frame, or in the window or frame specified by the menu control's Target ptoperty. You can, however, optionally set the individual menu item's Target property to specify the window or frame in which to display the linked content.
The following example demonstrates how to programmatically set the NavigateUrl property to specify the URL to navigate to when the user clicks a MenuItem.
MenuItem newItem = new MenuItem ( row [ "catalog" ].ToString ( ),
row [ "tops" ].ToString ( ) );
newItem.NavigateUrl = string.Format ( "~/shop/catalogs.aspx?mode={0}", row [ "mode" ] );
catalogsMenu.Items.Add ( newItem );
Show me
MenuItem Members