This documentation is archived and is not being maintained.

TitleStyle.Wrap Property

Gets or sets a value indicating whether the contents of the title bar for a part control wrap in the title bar.

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

public override bool Wrap { get; set; }

Property Value

Type: System.Boolean
true if the contents of a title bar wrap in the title bar; otherwise, false. The default is false.

The TitleStyle class overrides the base Wrap property so that it can set the value to false. The TitleStyle sets the Wrap property to false, so that by default, a title bar for a part control does not allow its contents to wrap.

The following code example demonstrates the declarative use of the Wrap property. In the code for the following page, an <asp:calendar> element and an <asp:label> element appear within a zone, which gives the corresponding controls genuine Web Parts functionality at run time.

Notice that the <parttitlestyle> element, which contains several style attributes, applies to the title bars of both Web Parts controls contained within the zone. Notice also that the <parttitlestyle> element has wrap and width attributes. Because the Wrap property value is set to true, and the text in the title bars of the two controls is wider than the value assigned to the width attribute, the title bar text of each control wraps when the page is loaded in a browser.


<%@ 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 id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1">
        <parttitlestyle 
          font-bold="true" 
          BorderWidth="2" 
          ForeColor="#3300cc" 
          wrap="true" Width="100"/>
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <asp:calendar 
            ID="cal1" 
            Runat="server" 
            Title="My Calendar" />
          <asp:Label id="label1" runat="server" 
            Title="A WebPart Label">
            The label control acts as a WebPart.
          </asp:Label>
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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