CatalogZoneBase.SelectedCatalogPartID プロパティ

定義

ゾーン内で現在選択されている CatalogPart コントロールの識別子としての文字列を取得または設定します。

public:
 property System::String ^ SelectedCatalogPartID { System::String ^ get(); void set(System::String ^ value); };
[System.Web.UI.Themeable(false)]
public string SelectedCatalogPartID { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.SelectedCatalogPartID : string with get, set
Public Property SelectedCatalogPartID As String

プロパティ値

現在選択しているコントロールの識別子として機能する文字列。 既定値はコントロールの ID プロパティの値です。

属性

次のコード例では、 プロパティを宣言的およびプログラム的に使用 SelectedCatalogPartID する方法を示します。 この例を実行するために必要な完全なコードについては、クラスの概要の「例」セクションを CatalogZoneBase 参照してください。

コード例の最初の部分では 2 つの <asp:catalogzone> 要素が宣言され、最初の部分では プロパティの値が宣言されていることに SelectedCatalogPartID 注意してください。

<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." />

コード例の 2 番目の部分では、現在選択されているコントロールの SelectedCatalogPartID プロパティのテキスト値が表示されます。

protected void Button4_Click(object sender, EventArgs e)
{
  Label1.Text = CatalogZone1.SelectedCatalogPartID;
}
Protected Sub Button4_Click(ByVal sender As Object, _
  ByVal e As EventArgs)
  Label1.Text = CatalogZone1.SelectedCatalogPartID
End Sub

ブラウザーでページを読み込むと、ドロップダウン リストから [ カタログ ] を選択してカタログ表示モードに切り替えることができます。 カタログが表示されたら、コントロールへの CatalogPart リンクのいずれかをクリックして選択します。 次に、[ 選択したカタログの表示][パーツ ID ] ボタンをクリックして、プロパティ値を表示します。 プロパティの値は、ゾーンに対して宣言的に設定された値であることに注意してください。 ゾーン内の他 CatalogPart のコントロールを選択した場合、同じ値が選択されたときに各コントロールのプロパティの SelectedCatalogPartID 値になります。 プロパティの SelectedCatalogPartID 値を設定しない場合、既定値は常に現在選択されているコントロールのプロパティの ID 値です。

注釈

SelectedCatalogPartIDプロパティを使用すると、現在選択CatalogPartされているコントロールの任意の識別子を設定できます。 これにより、コントロールのプロパティ値は変更されないため、独自の ID プログラム目的でこのプロパティを使用できます。 たとえば、現在選択 CatalogPart されているコントロールに対してプログラムによる操作を常に実行する場合、このプロパティを使用すると、事前に設定した既知の値を使用してそのコントロールにアクセスできます。

このプロパティは、テーマまたはスタイル シート テーマによって設定することはできません。 詳細については、「テーマとスキン」と「ASP.NET」を参照してくださいThemeableAttribute

適用対象

こちらもご覧ください