Menu.ItemWrap Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets a value indicating whether the text for menu items should wrap.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public bool ItemWrap { get; set; }

Property Value

Type: System.Boolean

true to wrap the menu item text; otherwise, false. The default is false.

Use the ItemWrap property to specify whether the text displayed in each menu item wraps. When the text runs out of space, it is automatically split and continued on the following line.

The following code example demonstrates how to use the ItemWrap property to enable text wrapping in the Menu control.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >

  <head runat="server">
    <title>Menu ItemWrap Example</title>
    <form id="form1" runat="server">

      <h3>Menu ItemWrap Example</h3>

      <!-- Place the Menu control in a table to force text -->
      <!-- wrapping to occur.                              -->
      <table style="border:1; height:100%">
          <td style="width:200px; vertical-align:top">
            <asp:menu id="NavigationMenu"

              <staticmenuitemstyle verticalpadding="10"/> 

                <asp:menuitem text="How to Add a Menu Control to a Web Form">
                  <asp:menuitem text="Procedure 1">
                    <asp:menuitem text="Step 1"/>
                    <asp:menuitem text="Step 2"/>



.NET Framework
Available since 2.0
Return to top