CatalogIconImageUrl Property

WebPart.CatalogIconImageUrl Property


Gets or sets the URL to an image that represents a Web Parts control in a catalog of controls.

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

public virtual string CatalogIconImageUrl { get; set; }

Property Value

Type: System.String

A string that represents the URL to an image used to represent the control in a catalog. The default value is an empty string ("").

Exception Condition

The internal validation system has determined that the URL might contain script attacks.

The personalization scope of this property is set to Shared and can be modified only by authorized users. For more information, see PersonalizableAttribute and Web Parts Personalization Overview.

The following code example demonstrates how to set the CatalogIconImageUrl property for a WebPart control, so that an image appears with the control in a catalog of controls. This example assumes the use of a custom control, TextDisplayWebPart, created in the Example section of the WebPart class overview.

The code example also uses a custom user control that enables users to change display modes on a Web Parts page. The user control is referenced by means of a Register directive near the top of the Web page that hosts the user control. For a detailed description of how to create this user control and work with display modes, see Walkthrough: Developing and Using a Custom Web Server Control.

In the declarative markup of the Web page, note the <asp:CatalogZone> element. Nested within it are several elements, including an <aspSample:TextDisplayWebPart> element. This set of elements enables the custom WebPart control to appear in a catalog. In the markup for the <aspSample:TextDisplayWebPart> element, notice that the CatalogIconImageUrl attribute is assigned a string that contains the URL to an image file. Load the page in a browser and use the Display Mode drop-down list control to change the display mode to catalog mode. Then use the catalog user interface (UI) to add the custom WebPart control to the page.

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft