Export (0) Print
Expand All
Expand Minimize

Menu.ItemWrap Property

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; }
<asp:Menu ItemWrap="True|False" />

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"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

  <head runat="server">
    <title>Menu ItemWrap Example</title>
</head>
<body>
    <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%">
        <tr>
          <td style="width:200px; vertical-align:top">
            <asp:menu id="NavigationMenu"
              staticdisplaylevels="2"
              staticsubmenuindent="10" 
              orientation="Vertical"
              itemwrap="true"
              dynamicverticaloffset="10"    
              runat="server">

              <staticmenuitemstyle verticalpadding="10"/> 

              <items>
                <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"/>
                  </asp:menuitem>
                </asp:menuitem>
              </items>

            </asp:menu>
          </td>
        </tr>      
      </table>

    </form>
  </body>
</html>

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft