Redigera

Dela via


WebPartDescription.CatalogIconImageUrl Property

Definition

Gets a URL containing the path to an image used as an icon for a WebPart control.

public:
 property System::String ^ CatalogIconImageUrl { System::String ^ get(); };
public string CatalogIconImageUrl { get; }
member this.CatalogIconImageUrl : string
Public ReadOnly Property CatalogIconImageUrl As String

Property Value

A string that contains a URL; the default value is an empty string ("").

Examples

The following code example demonstrates programmatic use of the CatalogIconImageUrl 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 CatalogIconImageUrl 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 />";
  }
}
Protected Sub Button1_Click(ByVal sender As Object, _
  ByVal e As System.EventArgs)
  
  Label1.Text = String.Empty
      
  Dim descriptions As WebPartDescriptionCollection = _
   DeclarativeCatalogPart1.GetAvailableWebPartDescriptions()
          
  Dim desc As WebPartDescription
      
  For Each desc In descriptions
    Label1.Text += "ID: " & desc.ID & "<br />" & _
      "Title: " & desc.Title & "<br />" & _
      "Description: " & desc.Description & "<br />" & _
      "ImageUrl: " & desc.CatalogIconImageUrl & "<br />" & _
      "<hr />"
  Next
  
End Sub

Remarks

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

The CatalogIconImageUrl 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 an icon assigned to it in the property value, the icon appears in the catalog next to the control.

Applies to

See also