Export (0) Print
Expand All

WebPartDescription.Title Property

Note: This property is new in the .NET Framework version 2.0.

Gets the title text of a corresponding WebPart control.

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

public string Title { get; }
/** @property */
public String get_Title ()

public function get Title () : String

Property Value

A string that contains the title of the corresponding control. The default value is a calculated string supplied by the .NET Framework.

The value of the Title property corresponds directly to the WebPart.DisplayTitle property. Whatever the corresponding WebPart control has for its DisplayTitle property, that becomes the value of the Title property; otherwise, the title is a calculated value.

The Title property applies only when a page is in catalog display mode, and a WebPart control is being displayed in a catalog of controls. Whatever title is assigned to a WebPart control appears next to the control in the catalog.

The following code example demonstrates programmatic use of the Title 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 Title 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 />";
  }
}

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft