Export (0) Print
Expand All

WebPartDescription.Description Property

Gets the text of a description for a WebPart control.

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

public string Description { get; }

Property Value

Type: System.String
A string that contains the description for a WebPart control; the default value is an empty string ("").

The Description property corresponds directly to the Part.Description property. If that property is set on a WebPart control, then the property in the corresponding WebPartDescription object will also have a value.

The Description property applies only when a page is in catalog display mode, and a WebPart control is being displayed in a catalog of controls. If the control has a description assigned to it, the description appears in the catalog as a ToolTip on the control.

The following code example demonstrates programmatic use of the Description property. For the full code required to run this code example, see the Example section of the WebPartDescription class overview topic.

The following code in the Button1_Click method of a Web page demonstrates how to get the collection of WebPartDescription objects in a catalog using the GetAvailableWebPartDescriptions method, and then to display the details of each WebPart control in the catalog by looping through the WebPartDescription objects. Note that the Description property value is retrieved in the following code.

protected void Button1_Click(object sender, EventArgs e)
{
  Label1.Text = String.Empty;

  WebPartDescriptionCollection descriptions = 
    DeclarativeCatalogPart1.GetAvailableWebPartDescriptions();

  foreach (WebPartDescription desc in descriptions)
  {
    Label1.Text += "ID: " + desc.ID + "<br />" +
      "Title: " + desc.Title + "<br />" +
      "Description: " + desc.Description + "<br />" +
      "ImageUrl: " + desc.CatalogIconImageUrl + "<br />" +
      "<hr />";
  }
}

.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