DeclarativeCatalogPart::WebPartsListUserControlPath Property
Gets or sets the path to a user control that contains a list of WebPart or other server controls for the catalog.
Assembly: System.Web (in System.Web.dll)
[ThemeableAttribute(false)] public: property String^ WebPartsListUserControlPath { String^ get (); void set (String^ value); }
<asp:DeclarativeCatalogPart WebPartsListUserControlPath="String" />
Property Value
Type: System::StringA string with the path to a user control that contains a set of WebPart or server controls.
The WebPartsListUserControlPath property enables developers to specify the path to a user control that contains a set of WebPart or other server controls that can be added to a WebPartZoneBase zone. If a valid path to a user control is assigned to this property, the controls are automatically added to the catalog at compile time.
The WebPartsListUserControlPath property can be useful because it provides a way to package and reuse a set of available controls across many different pages or sites. Rather than manually declaring each control in a catalog for every page that wants to provide a catalog, developers can use this property to point to a user control that references an entire set of WebPart controls. Also, the WebPartsListUserControlPath property can be used along with WebPart controls that are explicitly declared within an <asp:declarativecatalogpart> element on a Web page.
This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins Overview.
The following code example shows how to use the WebPartsListUserControlPath property declaratively and programmatically. This example has five parts:
A user control that enables you to change display modes on a Web Parts page.
A source code file that contains two custom WebPart controls.
Another user control that contains references to the custom WebPart controls, and is referenced by the WebPartsListUserControlPath property on the Web page.
A Web page that contains a CatalogZone control and a DeclarativeCatalogPart control that references the user control containing the custom controls.
An explanation of how the example works when you load the page in a browser.
The first part of this code example is the user control that enables users to change display modes on a Web page. For details about display modes and a description of the source code in this control, see Walkthrough: Changing Display Modes on a Web Parts Page.
The second part of the code example is the source code for the two custom WebPart controls. For the code example to run, you must compile this source code. You can compile it explicitly and put the resulting assembly in your Web site's Bin folder or the global assembly cache. Alternatively, you can put the source code in your site's App_Code folder, where it will be dynamically compiled at run time. For a walkthrough that demonstrates both methods of compiling, see Walkthrough: Developing and Using a Custom Web Server Control.
The third part of the code example is the user control that contains the custom WebPart controls, and is referenced by the WebPartsListUserControlPath property.
The fourth part of the example is the Web page that contains the DeclarativeCatalogPart control. Notice that the WebPartsListUserControlPath property is set declaratively in the markup of the page; the property value can also be set programmatically when the user clicks a button that is exposed when the page is in catalog display mode.
When you load the page in a browser, select Catalog Mode in the Display Mode drop-down list control to switch to catalog mode. In catalog mode, you can see the controls that are available to be added to the page. Click the Update WebPartsListUserControlPath property button, without entering a value in the text box. Notice that with an empty string ("") assigned to the property, the catalog is updated and only the control that is explicitly declared in the page remains in the catalog. If you type the name of the user control that contains the WebPart controls in the text box, and click the Update WebPartsListUserControlPath property button again, the WebPartsListUserControlPath property now points to the user control again, and the additional WebPart controls reappear in the catalog.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.