Compartilhar via


WebPart.Width Property

Gets or sets the fixed width for a Web Part.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<WebPartStorageAttribute(Storage := Storage.Personal)> _
<PersonalizableAttribute> _
Public Property Width As String
    Get
    Set
'Usage
Dim instance As WebPart
Dim value As String

value = instance.Width

instance.Width = value
[WebPartStorageAttribute(Storage = Storage.Personal)]
[PersonalizableAttribute]
public string Width { get; set; }

Property Value

Type: System.String
A string that specifies the fixed width of the Web Part. Any width value that is allowed in CSS can be used. The default value is String.Empty.

Remarks

Use this property to restrict the width of a Web Part on the Web Part Page. If this property is not set or if it is set to Empty, the Web Part is expanded to fill the width of the zone that contains it.

The value of string is a number followed by a two-character abbreviation that indicates a unit of measure, for example, 50px for 50 pixels. If no unit of measure is indicated, the number defaults to pixels. The following units of measure are supported: cm (centimeters)

  • in (inches)

  • mm (millimeters)

  • pc (picas)

  • pt (points)

  • px (pixels)

This property can be personalized by individual users. Its WebPartStorageAttribute value is Storage.Personal, which specifies that the property can be stored on a per-user basis. Only users with the Personalize Web Part pages right can set this property. It can be set programmatically, or it can be set through the Web Part task pane in the personal view of the Web-based user interface, or by using a SharePoint Foundation-compatible HTML editor, such as SharePoint Designer.

See Also

Reference

WebPart Class

WebPart Members

Microsoft.SharePoint.WebPartPages Namespace