Tab
A newer version of this page is available. Switch to the current version.

MenuItem.Text Property

Gets or sets the text content of the current menu item.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue("Item")]
public string Text { get; set; }
<DefaultValue("Item")>
Public Property Text As String

Property Value

Type Default Description
String

"Item"

A string value that specifies the text content of the MenuItem.

Remarks

Use the Text property to specify the current menu item's text content. The position of the text within items is specified by the AppearanceStyleBase.HorizontalAlign and AppearanceStyleBase.VerticalAlign properties available via the corresponding style properties of a menu control or a menu item object.

If the MenuItem.NavigateUrl property of a menu item is assigned, the item serves as a hyperlink and the appearance of the item's text set by the Text property can be controlled via the ASPxMenuBase.LinkStyle property.

In addition to the text, you can specify a menu item's image and hint text using the MenuItem.Image and MenuItem.ToolTip properties respectively.

NOTE

If the Text property is empty and an item image is specified, a text element markup is not rendered. In this case, it is impossible to set a text on the client side using the ASPxClientMenuItem.SetText method.

Examples

This sample shows how to bind the ASPxMenu to data stored in a database.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

public partial class ASPxperience_Menu_BuildMenuFromDB_BuildMenuFromDB : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        BuildMenu(ASPxMenu1, AccessDataSource1);
    }

    protected void BuildMenu(DevExpress.Web.ASPxMenu.ASPxMenu menu, SqlDataSource dataSource) {
        // Get DataView
        DataSourceSelectArguments arg = new DataSo