System.Web.UI.WebControls.MenuItemBinding.TextField Property

Gets or sets the name of the field from the data source to bind to the MenuItem.Text property of a System.Web.UI.WebControls.MenuItem object to which the System.Web.UI.WebControls.MenuItemBinding object is applied.

Syntax

[System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.DefaultValue("")]
public string TextField { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

When the System.Web.UI.WebControls.Menu control is bound to a data source, use the MenuItemBinding.TextField property to specify the name of the field to bind to the MenuItem.Text property of a System.Web.UI.WebControls.MenuItem object. When rendered, the MenuItem.Text property of each menu item to which the System.Web.UI.WebControls.MenuItemBinding object is applied contains the corresponding value from the field. This text is displayed in the menu items.

Note:

You can override the text for an individual menu item by setting its MenuItem.Text property directly.

If the data source contains multiple tables or attributes, you must first establish the binding criteria by setting the MenuItemBinding.Depth property, the MenuItemBinding.DataMember property, or both.

You cannot create empty nodes in a System.Web.UI.WebControls.Menu control by setting the MenuItemBinding.Text or MenuItemBinding.TextField properties to the empty string (""). Setting these properties to the empty string has the same effect as not setting the properties. In that case, the System.Web.UI.WebControls.Menu control creates a default binding using the BaseDataBoundControl.DataSource property. For more information, see Accessing Data with ASP.NET.

Instead of using this property to bind the MenuItem.Text property of a System.Web.UI.WebControls.MenuItem object to a field, you can also bind it to a static value by setting the MenuItemBinding.Text property. This allows you to display the same text in each menu item to which the System.Web.UI.WebControls.MenuItemBinding object is applied.

Note:

If the MenuItemBinding.Text and MenuItemBinding.TextField properties are both set, the MenuItemBinding.TextField property takes precedence.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0