System.Web.UI.WebControls Namespace MenuItem Class
.NET Framework version 2.0
Initializes a new instance of the MenuItem class with the specified menu text and value.
[ VB ]
Overloads Public Sub New ( _
ByVal text As String, _
ByVal value As String _
)
[ C# ]
public MenuItem (
string text,
string value
);
[ C++ ]
public: MenuItem (
String* text,
String* value
);
[ JScript ]
public function MenuItem (
text : String,
value : String
);
- text
- The text to display for the MenuItem.
- value
- The value associated with the MenuItem.
Use this constructor to initialize a new instance of the MenuItem class using the specified menu text and value.
The following table shows initial property values for an instance of MenuItem.
Property |
Initial Value |
Text |
The value of the text parameter. |
Value |
The value of the value parameter. |
The following example shows how to programmatically add root menu item objects to the Items collection of a Menu control using this constructor.
MenuItem newItem = new MenuItem ( menuitemText, menuItemValue );
newItem.NavigateUrl = webPageUrl;
menuObject.Items.Add ( newItem );
Dim newItem As New MenuItem ( menuitemText, menuItemValue );
newItem.NavigateUrl = webPageUrl;
menuObject.Items.Add ( newItem ); |
|
C# |
VB |
Show me
MenuItem Members MenuItem Constructor Overload List