Redigeeri

Jagamisviis:


CatalogZoneBase.PartLinkStyle Property

Definition

Gets an object that contains style attributes for the CatalogPart controls that are not currently selected in the zone.

public:
 property System::Web::UI::WebControls::Style ^ PartLinkStyle { System::Web::UI::WebControls::Style ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.Style PartLinkStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.PartLinkStyle : System.Web.UI.WebControls.Style
Public ReadOnly Property PartLinkStyle As Style

Property Value

A Style that contains style attributes for the controls that are not currently selected.

Attributes

Examples

The following code example demonstrates how to use the PartLinkStyle property declaratively and programmatically. For the full code required to run the example, see the Example section of the CatalogZoneBase class overview.

Notice that the first part of the code example declares two <asp:catalogzone> elements, and the first one declares a value for the PartLinkStyle property.

<asp:CatalogZone ID="CatalogZone1" runat="server"
  EmptyZoneText="No controls are in the zone."
  HeaderText="My Web Parts Catalog"
  InstructionText="Add Web Parts controls to the zone."
  PartLinkStyle-Font-Italic="true"
  SelectedPartLinkStyle-Font-Bold="true"
  SelectTargetZoneText="Select zone"
  AddVerb-Text="Add Control"
  CloseVerb-Description="Close and return to browse mode." 
  SelectedCatalogPartID="Currently Selected CatalogPart ID.">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
      runat="server">
      <WebPartsTemplate>
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="textwebpart" 
          title = "Text Content WebPart" 
          ExportMode="All"/>  
        <asp:Calendar id="calendar1" runat="server" 
          Title="My Calendar" />               
      </WebPartsTemplate>
    </asp:DeclarativeCatalogPart> 
    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
    <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server" /> 
  </ZoneTemplate>
</asp:CatalogZone>
<hr />
<asp:CatalogZone ID="CatalogZone2" runat="server"
  BorderWidth="2"
  HeaderText="My Empty CatalogZone"
  EmptyZoneText="No controls are in the zone." />
<asp:CatalogZone ID="CatalogZone1" runat="server"
  EmptyZoneText="No controls are in the zone."
  HeaderText="My Web Parts Catalog"
  InstructionText="Add Web Parts controls to the zone."
  PartLinkStyle-Font-Italic="true"
  SelectedPartLinkStyle-Font-Bold="true"
  SelectTargetZoneText="Select zone"
  AddVerb-Text="Add Control"
  CloseVerb-Description="Close and return to browse mode." 
  SelectedCatalogPartID="Currently Selected CatalogPart ID.">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
      runat="server">
      <WebPartsTemplate>
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="textwebpart" 
          title = "Text Content WebPart" 
          ExportMode="All"/>  
        <asp:Calendar id="calendar1" runat="server" 
          Title="My Calendar" />               
      </WebPartsTemplate>
    </asp:DeclarativeCatalogPart> 
    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
    <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server" /> 
  </ZoneTemplate>
</asp:CatalogZone>
<hr />
<asp:CatalogZone ID="CatalogZone2" runat="server"
  BorderWidth="2"
  HeaderText="My Empty CatalogZone"
  EmptyZoneText="No controls are in the zone." />

In the second part of the code example, the text color for the unselected CatalogPart controls is set to a different value.

protected void Button5_Click(object sender, EventArgs e)
{
  CatalogZone1.PartLinkStyle.ForeColor = System.Drawing.Color.Red;
  CatalogZone1.SelectedPartLinkStyle.ForeColor = 
    System.Drawing.Color.Blue;
}
Protected Sub Button5_Click(ByVal sender As Object, _
  ByVal e As EventArgs)
  CatalogZone1.PartLinkStyle.ForeColor = _
    System.Drawing.Color.Red
  CatalogZone1.SelectedPartLinkStyle.ForeColor = _
    System.Drawing.Color.Blue
End Sub

When you load the page in a browser, you can select Catalog from the drop-down list to switch to catalog display mode. When the catalog is visible, notice the style attributes of the unselected CatalogPart controls listed in the zone (by default, the selected CatalogPart control is the DeclarativeCatalogPart control). You can click the Change Part Link Styles button to change the text color of the unselected controls. You can also click the links for the unselected controls, to see how the style attributes change when a control is selected.

Remarks

In a CatalogZoneBase zone, links are displayed for each type of CatalogPart control: PageCatalogPart, DeclarativeCatalogPart, and ImportCatalogPart. When a user clicks one of the links, the corresponding CatalogPart control becomes the selected control, and the child controls contained by that selected control become visible.

The Style object referenced by the PartLinkStyle property contains the style attributes for the CatalogPart controls that are not currently selected. Although the object referenced by the property is read-only, you can still use it to set the underlying style characteristics for the unselected CatalogPart controls.

Applies to

See also