Skip to main content
Tab

ASPxMenu.Orientation Property

Gets or sets the direction in which to render the menu.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(Orientation.Horizontal)]
public Orientation Orientation { get; set; }

Property Value

Type Default Description
Orientation Horizontal

One of the Orientation enumeration values.

Remarks

Use the Orientation property to specify the direction in which to render the menu control.

On the client side, you can control the menu orientation using the ASPxClientMenu.GetOrientation and ASPxClientMenu.SetOrientation methods.

Example

This sample illustrates how to keep the NavigateUrl of the item if there is a control in the ItemTemplate of the ASPxMenu.

<dx:ASPxMenu ID="ASPxMenu1" runat="server" DataSourceID="ASPxSiteMapDataSource1"
    Orientation="Vertical" OnDataBound="ASPxMenu1_DataBound">
    <ItemTemplate>
        <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text='<%#Container.Item.Text %>' 
                      Width="100px" Height="20px" Cursor="pointer">
        </dx:ASPxLabel>
    </ItemTemplate>
</dx:ASPxMenu>

</html>
protected void ASPxMenu1_DataBound(object sender, EventArgs e) {
    string url = "";
    for (int i = 0; i < ASPxMenu1.Items.Count; i++) {

        url = ASPxMenu1.Items[i].NavigateUrl;
        ASPxLabel lab = ASPxMenu1.Items[i].FindControl("ASPxLabel1") as ASPxLabel;
        if (lab != null) {
            lab.ClientSideEvents.Click = "function(s,e){window.location = '" + url + "';}";

            switch (lab.Text) {
                case "Yahoo!": {
                        lab.BackColor = System.Drawing.Color.LightPink;
                        break;
                }
                case "MSN": {
                        lab.BackColor = System.Drawing.Color.LightSkyBlue;
                        break;
                }
                case "Google": {
                        lab.BackColor = System.Drawing.Color.LightSeaGreen;
                        break;
                }
            }
        }
    }
}
See Also