ImportCatalogPartとは? わかりやすく解説

ImportCatalogPart イベント


ImportCatalogPart クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

あらかじめ定義した設定でコントロールを Web ページに追加できるように、WebPart コントロール (または WebPart コントロールとして使用される他の ASP.NET サーバー コントロール) の記述ファイルをインポートします。このクラスは継承できません。

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public NotInheritable Class
 ImportCatalogPart
    Inherits CatalogPart
Dim instance As ImportCatalogPart
public sealed class ImportCatalogPart : CatalogPart
public ref class ImportCatalogPart sealed :
 public CatalogPart
public final class ImportCatalogPart extends
 CatalogPart
public final class ImportCatalogPart extends
 CatalogPart
解説解説

ImportCatalogPart コントロールを使用すると、ユーザーは、WebPartZoneBase ゾーンに追加する WebPart コントロールまたはサーバー コントロールの設定を記述した記述ファイルをインポートできます。

ユーザーが記述ファイルをインポートした後、そのファイルで参照される WebPart コントロールが ImportCatalogPart コントロール内に表示されます。ユーザーはこのコントロールをページに追加できます。

記述ファイルとコントロール自体は同じではありません。これは、末尾に .WebPart 拡張子が付いた、コントロールの状態を記述した名前/値ペア (ほとんどはプロパティ値) を含む XML ファイルです。記述ファイルは、「Web パーツ コントロール記述ファイル」トピックに記述されているように、指定した XML 形式に従って作成されています。

記述ファイルで参照されるコントロールには、コンパイル済みのアセンブリか、.ascx ファイルで定義されるユーザー コントロールを使用できます。どちらの場合も、インポートされる記述ファイルで参照されるコントロールは、そのコントロールをインポートしようとしてるページをホストする Web サーバーに存在する必要があります。記述ファイルは、コントロール名、そのコントロールを含むアセンブリ (またはファイル) を参照します。また、記述ファイルには、コントロールのプロパティ値、外観、および動作に影響する設定が含まれています。

ImportCatalogPart コントロールを使用すると、ユーザーがコントロールの設定を共有できます。複合コントロールでは、多数のプロパティおよび設定を保持できます。たとえば、大企業の典型的なイントラネット サイトでは、カスタムの WebPart コントロールに、データベース接続や部署の情報など、ユーザーの環境固有の値を保持するプロパティが多数含まれている場合があります。コントロールに、その外観に影響する多数のプロパティが含まれている場合もあります。1 人のユーザーが、特定のサイトのコントロールをパーソナル化して適切に動作するようにし、そのコントロールの記述ファイルをエクスポートして、それを他のユーザーと共有できます。他のユーザーは、そのファイルをインポートして、構成が完了しているコントロールを他のイントラネット サイトに追加して、そのサイトでパーソナル化できます。コントロールが含まれるコンパイル済みのアセンブリやユーザー コントロール ファイルが、そのサイトをホストしている Web サーバー上に存在する限り、ユーザーはそのコントロールを他の Web サイトに追加できます。

ユーザーが記述ファイル (およびそれに関連付けられたサーバー コントロール) を Web ページにインポートするために使用する機構は、ImportCatalogPart コントロールです。ページ開発者は、このコントロールを Web ページに追加する必要があります。ユーザーがページをカタログ表示モードに切り替えると、ImportCatalogPart コントロールが表示されます。ユーザーはこのコントロールを使用して、インポートするサーバー コントロールに対応する .WebPart 記述ファイルを参照できます。ImportCatalogPart コントロールによって提供される UI と指示に従って、ユーザーは、インポートした記述ファイルで指定されたとおりに外観とプロパティが完全に構成されている、目的のサーバー コントロールを Web ページに追加できます。

ユーザーは、WebPart コントロールの記述ファイルをインポートする前に、まず、そのファイルを既存の WebPart コントロールに基づいて作成 (エクスポート) する必要があります。記述ファイルは、次の条件が満たされている場合にコントロールに対してエクスポートできます。

ユーザーは、コントロールの動詞メニューに表示されている export 動詞をクリックし、そのコントロールの .WebPart 記述ファイルの保存についての指示に従うことによって、エクスポートが有効になっているコントロールをエクスポートできます。他のユーザーは、このファイルをインポートして、各自のコントロールのインスタンスを構成できます。

ImportCatalogPart クラスには、いくつかのプロパティが含まれています。BrowseHelpText プロパティには、ユーザーが記述ファイルを参照して検索するときの指示を含むテキストが格納されます。ImportedPartLabelText プロパティには、インポートされたコントロールが ImportCatalogPart コントロール内に表示されるときに、そのラベルとして機能するテキストが格納されます。PartImportErrorLabelText には、コントロールの説明をインポートしようとしてエラーが発生した場合に表示されるテキストが格納されます。Title プロパティは、開発者がタイトルを代入していない場合に、基本プロパティをオーバーライドして、ImportCatalogPart コントロールの既定のタイトルを代入します。UploadButtonText プロパティには、ユーザーが記述ファイルをアップロードするときにクリックするボタンのテキストが格納されます。また、UploadHelpText プロパティには、アップロード プロセスの指示が格納されます。

ImportCatalogPart クラスには、固有のメソッドもいくつかあります。GetAvailableWebPartDescriptions メソッドは、カタログ内の各 WebPart コントロールに対する WebPartDescription オブジェクトを取得します。カタログでは、ImportCatalogPart コントロールを使用することで、各サーバー コントロールについての情報をそのコントロールのインスタンスを作成しなくても表示できます。GetWebPart メソッドは、そのメソッドに渡される説明に基づいて、特定の WebPart コントロールのインスタンスを取得します。

ImportCatalogPart コントロールの使用に関連する本質的なリスクがいくつか存在します。1 つの例は、インポートに使用する記述ファイルを通じて、悪意あるデータを Web アプリケーションにインポートする可能性です。何者かが悪意あるスクリプト コードを文字列プロパティの値として記述ファイルに含めた場合、ユーザーがその記述ファイルをインポートし、参照されるサーバー コントロールを Web ページに追加すると、そのスクリプトが実行される可能性があります。悪意あるデータを含んだ記述ファイルをインポートするリスクを最小限に抑えるには、文字列型のプロパティを持つサーバー コントロールでは常にプロパティ データをエンコードする必要があります。別のリスクは、記述ファイルを通じた型のインポートによって発生します (「Web パーツ コントロール記述ファイル」 を参照してください)。悪意あるユーザーが大量のアセンブリを AppDomain に読み込む要求を送信する可能性があり、これによって限度を超えた量のメモリが消費される結果となります。

インポートに関連するリスクを回避するには、インポート機能や ImportCatalogPart コントロールを使用しないことによってこの機能を完全に無効にします。または、このコントロールにアクセスできるユーザーを制限できます。これは、ロール管理を使用して、プログラムによって行います (「ロールを使用した承認の管理」を参照してください)。たとえば、ページの読み込み時に、ユーザーが管理者ロールなど特定のロールに含まれているかどうかを確認するテストを実行できます。ユーザーがそのロールに含まれていれば、プログラムによって ImportCatalogPart コントロールをそのユーザーのページに追加できます。宣言による方法を使用して、ImportCatalogPart コントロールを使用できるユーザーを制限することもできます。カタログが含まれる Web ページ内に、2 つの CatalogZone コントロールを配置できます。1 つはインポートできるユーザー用、もう 1 つはインポートできないユーザー用です。インポートできるユーザー用のゾーンには、ImportCatalogPart コントロールを含めます。ゾーン自体を LoginView コントロール内に配置できます。これにより、ゾーン内のコントロールの使用を、認証されたユーザーや指定したロールだけに制限できます。

使用例使用例

Web ページ上の ImportCatalogPart コントロールを宣言およびプログラムによって使用する方法を次のコード例に示します。この例は、4 つの部分で構成されます。

コード例の最初の部分は、Web ページ上の表示モードをユーザーが変更できるようにするユーザー コントロールです。次のソース コードをファイルに配置し、そのファイルに (使用する言語に応じて) Displaymodemenucs.ascx または Displaymodemenuvb.ascx という名前を付けます。表示モードの詳細、およびこのコントロールのソース コードの説明については、「チュートリアル : Web パーツ ページでの表示モードの変更」を参照してください。

<%@ control language="vb" classname="DisplayModeMenuVB"%>
<script runat="server">
  ' Use a field to reference the current WebPartManager.
  Dim _manager As WebPartManager

  Sub Page_Init(ByVal sender As
 Object, ByVal e As EventArgs)
    AddHandler Page.InitComplete, AddressOf
 InitComplete
  End Sub

  Sub InitComplete(ByVal sender As
 Object, ByVal e As System.EventArgs)
    _manager = WebPartManager.GetCurrentWebPartManager(Page)
      
    Dim browseModeName As String
 = WebPartManager.BrowseDisplayMode.Name
      
    ' Fill the dropdown with the names of supported display modes.
    Dim mode As WebPartDisplayMode
    For Each mode In _manager.SupportedDisplayModes
      Dim modeName As String
 = mode.Name
      ' Make sure a mode is enabled before adding it.
      If mode.IsEnabled(_manager) Then
        Dim item As New
 ListItem(modeName, modeName)
        DisplayModeDropdown.Items.Add(item)
      End If
    Next mode
      
    ' If shared scope is allowed for this user, display the scope-switching
    ' UI and select the appropriate radio button for the current user
 scope.
    If _manager.Personalization.CanEnterSharedScope Then
      Panel2.Visible = True
      If _manager.Personalization.Scope = PersonalizationScope.User
 Then
        RadioButton1.Checked = True
      Else
        RadioButton2.Checked = True
      End If
    End If
   
  End Sub

  ' Change the page to the selected display mode.
  Sub DisplayModeDropdown_SelectedIndexChanged(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    Dim selectedMode As String
 = DisplayModeDropdown.SelectedValue   
    Dim mode As WebPartDisplayMode = _
      _manager.SupportedDisplayModes(selectedMode)
    If Not (mode Is Nothing)
 Then
      _manager.DisplayMode = mode
    End If

  End Sub
   
  ' Set the selected item equal to the current display mode.
  Sub Page_PreRender(ByVal sender As
 Object, ByVal e As EventArgs)
    Dim items As ListItemCollection = DisplayModeDropdown.Items
    Dim selectedIndex As Integer
 = _
      items.IndexOf(items.FindByText(_manager.DisplayMode.Name))
    DisplayModeDropdown.SelectedIndex = selectedIndex

  End Sub

  ' Reset all of a user's personalization data for the page.
  Protected Sub LinkButton1_Click(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    _manager.Personalization.ResetPersonalizationState()
    
  End Sub

  ' If not in User personalization scope, toggle into it.
  Protected Sub RadioButton1_CheckedChanged(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    If _manager.Personalization.Scope = PersonalizationScope.Shared
 Then
      _manager.Personalization.ToggleScope()
    End If

  End Sub
   
  ' If not in Shared scope, and if user is allowed, toggle the scope.
  Protected Sub RadioButton2_CheckedChanged(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    If _manager.Personalization.CanEnterSharedScope AndAlso
 _
      _manager.Personalization.Scope = PersonalizationScope.User Then
      _manager.Personalization.ToggleScope()
    End If

  End Sub

</script>
<div>
  <asp:Panel ID="Panel1" runat="server"
 
    Borderwidth="1" 
    Width="230" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" >
    <asp:Label ID="Label1" runat="server"
 
      Text="&nbsp;Display Mode" 
      Font-Bold="true"
      Font-Size="8"
      Width="120" />
    <asp:DropDownList ID="DisplayModeDropdown"
 runat="server"  
      AutoPostBack="true" 
      Width="120"
      OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged"
 />
    <asp:LinkButton ID="LinkButton1" runat="server"
      Text="Reset User State" 
      ToolTip="Reset the current user's personalization data for
 the page."
      Font-Size="8" 
      OnClick="LinkButton1_Click" />
    <asp:Panel ID="Panel2" runat="server"
 
      GroupingText="Personalization Scope"
      Font-Bold="true"
      Font-Size="8" 
      Visible="false" >
      <asp:RadioButton ID="RadioButton1" runat="server"
 
        Text="User" 
        AutoPostBack="true"
        GroupName="Scope" OnCheckedChanged="RadioButton1_CheckedChanged"
 />
      <asp:RadioButton ID="RadioButton2" runat="server"
 
        Text="Shared" 
        AutoPostBack="true"
        GroupName="Scope" 
        OnCheckedChanged="RadioButton2_CheckedChanged"
 />
    </asp:Panel>
  </asp:Panel>
</div>
<%@ control language="C#" classname="DisplayModeMenuCS"%>
<script runat="server">
  
 // Use a field to reference the current WebPartManager.
  WebPartManager _manager;

  void Page_Init(object sender, EventArgs e)
  {
    Page.InitComplete += new EventHandler(InitComplete);
    
  }  

  void InitComplete(object sender, System.EventArgs e)
  {
    _manager = WebPartManager.GetCurrentWebPartManager(Page);

    String browseModeName = WebPartManager.BrowseDisplayMode.Name;

    // Fill the dropdown with the names of supported display modes.
    foreach (WebPartDisplayMode mode in _manager.SupportedDisplayModes)
    {
      String modeName = mode.Name;
      // Make sure a mode is enabled before adding it.
      if (mode.IsEnabled(_manager))
      {
        ListItem item = new ListItem(modeName, modeName);
        DisplayModeDropdown.Items.Add(item);
      }
    }

    // If shared scope is allowed for this user, display the scope-switching
    // UI and select the appropriate radio button for the current user
 scope.
    if (_manager.Personalization.CanEnterSharedScope)
    {
      Panel2.Visible = true;
      if (_manager.Personalization.Scope == PersonalizationScope.User)
        RadioButton1.Checked = true;
      else
        RadioButton2.Checked = true;
    }
    
  }
 
  // Change the page to the selected display mode.
  void DisplayModeDropdown_SelectedIndexChanged(object sender,
 EventArgs e)
  {
    String selectedMode = DisplayModeDropdown.SelectedValue;

    WebPartDisplayMode mode = _manager.SupportedDisplayModes[selectedMode];
    if (mode != null)
      _manager.DisplayMode = mode;
  }

  // Set the selected item equal to the current display mode.
  void Page_PreRender(object sender, EventArgs e)
  {
    ListItemCollection items = DisplayModeDropdown.Items;
    int selectedIndex = 
      items.IndexOf(items.FindByText(_manager.DisplayMode.Name));
    DisplayModeDropdown.SelectedIndex = selectedIndex;
  }

  // Reset all of a user's personalization data for the page.
  protected void LinkButton1_Click(object sender,
 EventArgs e)
  {
    _manager.Personalization.ResetPersonalizationState();
  }

  // If not in User personalization scope, toggle into it.
  protected void RadioButton1_CheckedChanged(object
 sender, EventArgs e)
  {
    if (_manager.Personalization.Scope == PersonalizationScope.Shared)
      _manager.Personalization.ToggleScope();
  }

  // If not in Shared scope, and if user is allowed, toggle the scope.
  protected void RadioButton2_CheckedChanged(object
 sender, EventArgs e)
  {
    if (_manager.Personalization.CanEnterSharedScope &&
 
        _manager.Personalization.Scope == PersonalizationScope.User)
      _manager.Personalization.ToggleScope();
  }
</script>
<div>
  <asp:Panel ID="Panel1" runat="server" 
    Borderwidth="1" 
    Width="230" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" >
    <asp:Label ID="Label1" runat="server" 
      Text="&nbsp;Display Mode" 
      Font-Bold="true"
      Font-Size="8"
      Width="120" />
    <asp:DropDownList ID="DisplayModeDropdown" runat="server"
  
      AutoPostBack="true" 
      Width="120"
      OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged"
 />
    <asp:LinkButton ID="LinkButton1" runat="server"
      Text="Reset User State" 
      ToolTip="Reset the current user's personalization data for
 the page."
      Font-Size="8" 
      OnClick="LinkButton1_Click" />
    <asp:Panel ID="Panel2" runat="server" 
      GroupingText="Personalization Scope"
      Font-Bold="true"
      Font-Size="8" 
      Visible="false" >
      <asp:RadioButton ID="RadioButton1" runat="server" 
        Text="User" 
        AutoPostBack="true"
        GroupName="Scope" OnCheckedChanged="RadioButton1_CheckedChanged"
 />
      <asp:RadioButton ID="RadioButton2" runat="server" 
        Text="Shared" 
        AutoPostBack="true"
        GroupName="Scope" 
        OnCheckedChanged="RadioButton2_CheckedChanged" />
    </asp:Panel>
  </asp:Panel>
</div>

コード例の 2 番目の部分は Web ページです。ページの先頭には 2 つの register ディレクティブがあります。1 つはユーザー コントロール用で、もう 1 つは、2 つのカスタム WebPart コントロールを格納しているコンパイル済みコンポーネント用です。ページには、宣言要素の適切な階層内に入れ子になった ImportCatalogPart コントロールへの宣言参照があります。また、いくつかのプロパティ値が <asp:importcatalogpart> 要素で宣言によって代入されています。また、Button1_Click メソッドにより、ImportCatalogPart コントロールの多くのプロパティ値が更新されます。

ページの WebPartZone コントロールでは、2 つのカスタム WebPart コントロールが宣言されます。<aspSample:userinfowebpart> コントロールには、exportmode="all" 属性があります。この属性は、ユーザーがコントロールの記述ファイルをエクスポートできるようにするために必要です。このファイルは、記述ファイルを使用してコントロールをインポートしようとする別のユーザーが後でインポートできます。

メモメモ

Web パーツ アプリケーションのユーザーが WebPart コントロールの記述ファイルをエクスポートできるようにするには、Web.config ファイルで <webParts> 要素 (これは <system.web> 要素の子です) に enableExport="true" 属性を追加することで、Web アプリケーションのエクスポート機能を有効にすることも必要です。エクスポートは既定では無効になっています。したがって、アプリケーションのエクスポートをまだ有効にしていない場合は、ここで Web.config ファイルを編集して有効にしてください。

<%@ page language="VB" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenuVB" 
  Src="DisplayModeMenuVB.ascx" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.VB.Controls"
 %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Protected Sub Button1_Click(ByVal
 sender As Object, _
    ByVal e As EventArgs)
      ImportCatalogPart1.Title = "Import Server Controls"
      ImportCatalogPart1.BrowseHelpText = "Enter the path to a
 " _
        & "description file."
      ImportCatalogPart1.UploadButtonText = "Upload Description"
      ImportCatalogPart1.UploadHelpText = "Upload a description
 file."
      ImportCatalogPart1.ImportedPartLabelText = "Imported Controls"
      ImportCatalogPart1.PartImportErrorLabelText = "An error
 occured " _
        & "during the import process."
  End Sub

  Protected Sub Page_Load(ByVal
 sender As Object, _
    ByVal e As EventArgs)
      Button1.Visible = false
  End Sub

  Protected Sub ImportCatalogPart1_PreRender(ByVal
 sender As Object, _
    ByVal e As EventArgs)
      Button1.Visible = true
  End Sub

</script>
<html>
  <head runat="server">
    <title>
      ImportCatalogPart Control
    </title>
  </head>
  <body>
    <form id="form1" runat="server">
      <asp:webpartmanager id="WebPartManager1"
 runat="server"  />
      <uc1:DisplayModeMenuVB ID="DisplayModeMenu1"
 runat="server" />
      <asp:webpartzone id="zone1" runat="server"
 >
        <PartTitleStyle BorderWidth=1 
          Font-Names="Verdana, Arial"
          Font-Size="110%"
          BackColor="LightBlue" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="TextDisplayWebPart1" 
            title = "Text Display WebPart" /> 
          <aspsample:userinfowebpart id="userinfo1"
 runat="server" 
            Title="User Information" exportmode="all"
 />
        </zonetemplate>
      </asp:webpartzone> 
      <asp:EditorZone ID="EditorZone1" runat="server">
        <ZoneTemplate>
          <asp:PropertyGridEditorPart ID="PropertyGridEditorPart1"
 
            runat="server" />
        </ZoneTemplate>
      </asp:EditorZone>
      <asp:CatalogZone ID="CatalogZone1" runat="server">
        <ZoneTemplate>
          <asp:ImportCatalogPart ID="ImportCatalogPart1"
 
            runat="server" 
            Title="My ImportCatalogPart" 
            OnPreRender="ImportCatalogPart1_PreRender"
            BrowseHelpText="Type a path or browse to
 find a control's 
              description file." 
            UploadButtonText="Upload Description File"
 
            UploadHelpText="Click the button to upload the
 description 
              file."
            ImportedPartLabelText="My User Information WebPart"
 
            PartImportErrorLabelText="An error occurred while
 trying 
              to import a description file."  />
        </ZoneTemplate>
      </asp:CatalogZone>
      <hr />
      <asp:Button ID="Button1" runat="server"
 
        Text="Update ImportCatalogPart" 
        OnClick="Button1_Click" />
    </form>
  </body>
</html>
<%@ page language="c#" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenuCS" 
  Src="DisplayModeMenuCS.ascx" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.CS.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  protected void Button1_Click(object sender,
 EventArgs e)
  {
    ImportCatalogPart1.Title = "Import Server Controls";
    ImportCatalogPart1.BrowseHelpText = "Enter the path to a "
      + "description file.";
    ImportCatalogPart1.UploadButtonText = "Upload Description";
    ImportCatalogPart1.UploadHelpText = "Upload a description file.";
    ImportCatalogPart1.ImportedPartLabelText = "Imported Controls";
    ImportCatalogPart1.PartImportErrorLabelText = "An error occured " 
      + "during the import process.";

  }
  
  protected void Page_Load(object sender, EventArgs
 e)
  {
    Button1.Visible = false;
  }

  protected void ImportCatalogPart1_PreRender(object
 sender, 
    EventArgs e)
  {
    Button1.Visible = true;
  }
</script>
<html>
  <head id="Head1" runat="server">
    <title>
      ImportCatalogPart Control
    </title>
  </head>
  <body>
    <form id="form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server"
  />
      <uc1:DisplayModeMenuCS ID="DisplayModeMenu1" runat="server"
 />
      <asp:webpartzone id="zone1" runat="server" >
        <PartTitleStyle BorderWidth=1 
          Font-Names="Verdana, Arial"
          Font-Size="110%"
          BackColor="LightBlue" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="TextDisplayWebPart1" 
            title = "Text Display WebPart" /> 
          <aspsample:userinfowebpart id="userinfo1" runat="server"
 
            Title="User Information" exportmode="all" />
        </zonetemplate>
      </asp:webpartzone> 
      <asp:EditorZone ID="EditorZone1" runat="server">
        <ZoneTemplate>
          <asp:PropertyGridEditorPart ID="PropertyGridEditorPart1" 
            runat="server" />
        </ZoneTemplate>
      </asp:EditorZone>
      <asp:CatalogZone ID="CatalogZone1" runat="server">
        <ZoneTemplate>
          <asp:ImportCatalogPart ID="ImportCatalogPart1" 
            runat="server" 
            Title="My ImportCatalogPart" 
            OnPreRender="ImportCatalogPart1_PreRender"
            BrowseHelpText="Type a path or browse to find a control's 
              description file." 
            UploadButtonText="Upload Description File" 
            UploadHelpText="Click the button to upload the description 
              file."
            ImportedPartLabelText="My User Information WebPart" 
            PartImportErrorLabelText="An error occurred while
 trying 
              to import a description file."  />
        </ZoneTemplate>
      </asp:CatalogZone>
      <hr />
      <asp:Button ID="Button1" runat="server" 
        Text="Update ImportCatalogPart" 
        OnClick="Button1_Click" />
    </form>
  </body>
</html>

コード例の 3 番目の部分は、2 つの WebPart コントロールのソース コードです。これらのコントロールではいくつかのプロパティに、WebBrowsable 属性がマークされています。これによって、PropertyGridEditorPart コントロールは、編集モードのときにユーザーがそれらのプロパティを編集するためのユーザー インターフェイス (UI) を動的に生成できます。プロパティには、WebDisplayName 属性もマークされています。これによって、編集中の UI で各コントロールの横に表示されるラベルのテキストを指定します。コード例を実行するためには、このソース コードをコンパイルする必要があります。それを明示的にコンパイルし、コンパイル済みのアセンブリを Web サイトの Bin フォルダまたはグローバル アセンブリ キャッシュに配置できます。サイトの App_Code フォルダにソース コードを配置し、実行時に動的にコンパイルすることもできます。このコード例は、動的コンパイルを使用します。両方のコンパイル方法を示すチュートリアルについては、「チュートリアル : カスタム サーバー コントロールの開発と使用」を参照してください。

TextDisplayWebPart と呼ばれるカスタム コントロールは、Web ページで <aspSample:TextDisplayWebPart> 要素によって参照されます。UserInfoWebPart という名前の別のコントロールも最初 Web ページ上で宣言されます。ただし、コントロールの記述ファイルをインポートする機能を示すために、後で削除することになります。

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts

Namespace Samples.AspNet.VB.Controls

  <AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Class UserInfoWebPart
    Inherits WebPart
    Private server As HttpServerUtility = HttpContext.Current.Server
    Private _userNickName As String
 = "Add a nickname."
    Private _userPetName As String
 = "Add a pet name."
    Private _userSpecialDate As DateTime =
 DateTime.Now
    Private _userIsCurrent As [Boolean] = True
    Private _userJobType As JobTypeName = JobTypeName.Unselected

    Public Enum JobTypeName
      Unselected = 0
      Support = 1
      Service = 2
      Professional = 3
      Technical = 4
      Manager = 5
      Executive = 6
    End Enum

    Private NickNameLabel As Label
    Private PetNickNameLabel As Label
    Private SpecialDateLabel As Label
    Private IsCurrentCheckBox As CheckBox
    Private JobTypeLabel As Label

    ' Add the Personalizable and WebBrowsable attributes to the  
    ' public properties, so that users can save property values  
    ' and edit them with a PropertyGridEditorPart control.

    <Personalizable(), WebBrowsable(), WebDisplayName("Nickname")>
 _
    Public Property NickName() As
 String
      Get
        Dim o As Object
 = ViewState("NickName")
        If Not (o Is Nothing)
 Then
          Return CStr(o)
        Else
          Return _userNickName
        End If
      End Get
      Set(ByVal value As
 String)
        _userNickName = server.HtmlEncode(value)
      End Set
    End Property

    <Personalizable(), WebBrowsable(), WebDisplayName("Pet
 Name")> _
    Public Property PetName() As
 String
      Get
        Dim o As Object
 = ViewState("PetName")
        If Not (o Is Nothing)
 Then
          Return CStr(o)
        Else
          Return _userPetName
        End If
      End Get
      Set(ByVal value As
 String)
        _userPetName = server.HtmlEncode(value)
      End Set
    End Property

    <Personalizable(), WebBrowsable(), WebDisplayName("Special
 Day")> _
    Public Property SpecialDay() As
 DateTime
      Get
        Dim o As Object
 = ViewState("SpecialDay")
        If Not (o Is Nothing)
 Then
          Return CType(o, DateTime)
        Else
          Return _userSpecialDate
        End If
      End Get

      Set(ByVal value As
 DateTime)
        _userSpecialDate = value
      End Set
    End Property

    <Personalizable(), WebBrowsable(), WebDisplayName("Job
 Type")> _
    Public Property UserJobType() As
 JobTypeName
      Get
        Dim o As Object
 = ViewState("UserJobType")
        If Not (o Is Nothing)
 Then
          Return CType(o, JobTypeName)
        Else
          Return _userJobType
        End If
      End Get
      Set(ByVal value As
 JobTypeName)
        _userJobType = CType(value, JobTypeName)
      End Set
    End Property

    <Personalizable(), WebBrowsable(), WebDisplayName("Is Current")>
 _
    Public Property IsCurrent() As
 [Boolean]
      Get
        Dim o As Object
 = ViewState("IsCurrent")
        If Not (o Is Nothing)
 Then
          Return CType(o, [Boolean])
        Else
          Return _userIsCurrent
        End If
      End Get
      Set(ByVal value As
 [Boolean])
        _userIsCurrent = value
      End Set
    End Property

    Protected Overrides Sub
 CreateChildControls()
      Controls.Clear()

      NickNameLabel = New Label()
      NickNameLabel.Text = Me.NickName
      SetControlAttributes(NickNameLabel)

      PetNickNameLabel = New Label()
      PetNickNameLabel.Text = Me.PetName
      SetControlAttributes(PetNickNameLabel)

      SpecialDateLabel = New Label()
      SpecialDateLabel.Text = Me.SpecialDay.ToShortDateString()
      SetControlAttributes(SpecialDateLabel)

      IsCurrentCheckBox = New CheckBox()
      IsCurrentCheckBox.Checked = Me.IsCurrent
      SetControlAttributes(IsCurrentCheckBox)

      JobTypeLabel = New Label()
      JobTypeLabel.Text = Me.UserJobType.ToString()
      SetControlAttributes(JobTypeLabel)

      ChildControlsCreated = True

    End Sub

    Private Sub SetControlAttributes(ByVal
 ctl As WebControl)
      ctl.BackColor = Color.White
      ctl.BorderWidth = 1
      ctl.Width = 200
      Me.Controls.Add(ctl)
    End Sub

    Protected Overrides Sub
 RenderContents(ByVal writer As HtmlTextWriter)
      writer.Write("Nickname:")
      writer.WriteBreak()
      NickNameLabel.RenderControl(writer)
      writer.WriteBreak()
      writer.Write("Pet Name:")
      writer.WriteBreak()
      PetNickNameLabel.RenderControl(writer)
      writer.WriteBreak()
      writer.Write("Special Date:")
      writer.WriteBreak()
      SpecialDateLabel.RenderControl(writer)
      writer.WriteBreak()
      writer.Write("Job Type:")
      writer.WriteBreak()
      JobTypeLabel.RenderControl(writer)
      writer.WriteBreak()
      writer.Write("Current:")
      writer.WriteBreak()
      IsCurrentCheckBox.RenderControl(writer)

    End Sub

  End Class


  <AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Class TextDisplayWebPart
    Inherits WebPart
    Private _contentText As String
 = Nothing
    Private _fontStyle As String
 = Nothing
    Private input As TextBox
    Private DisplayContent As Label
    Private lineBreak As Literal

    <Personalizable(), WebBrowsable()> _
    Public Property ContentText() As
 String
      Get
        Return _contentText
      End Get
      Set(ByVal value As
 String)
        _contentText = value
      End Set
    End Property

    Protected Overrides Sub
 CreateChildControls()
      Controls.Clear()
      DisplayContent = New Label()
      DisplayContent.BackColor = Color.LightBlue
      DisplayContent.Text = Me.ContentText
      Me.Controls.Add(DisplayContent)

      lineBreak = New Literal()
      lineBreak.Text = "<br />"
      Controls.Add(lineBreak)

      input = New TextBox()
      Me.Controls.Add(input)
      Dim update As New
 Button()
      update.Text = "Set Label Content"
      AddHandler update.Click, AddressOf Me.submit_Click
      Me.Controls.Add(update)

    End Sub

    Private Sub submit_Click(ByVal
 sender As Object, _
                             ByVal e As EventArgs)
      ' Update the label string.
      If String.IsNullOrEmpty(input.Text) =
 False Then
        _contentText = Context.Server.HtmlEncode(input.Text) + "<br
 />"
        input.Text = String.Empty
        DisplayContent.Text = Me.ContentText
      End If

    End Sub

  End Class

End Namespace
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  [AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  public class UserInfoWebPart : WebPart
  {
    HttpServerUtility server = HttpContext.Current.Server;
    private String _userNickName = "Add a nickname.";
    private String _userPetName = "Add a pet name.";
    private DateTime _userSpecialDate = DateTime.Now;
    private Boolean _userIsCurrent = true;
    private JobTypeName _userJobType = JobTypeName.Unselected;
    public enum JobTypeName
    {
      Unselected = 0,
      Support = 1,
      Service = 2,
      Professional = 3, 
      Technical = 4,
      Manager = 5,
      Executive = 6
    }
    Label NickNameLabel;
    Label PetNickNameLabel;
    Label SpecialDateLabel;
    CheckBox IsCurrentCheckBox;
    Label JobTypeLabel;

    // Add the Personalizable and WebBrowsable attributes to the  
    // public properties, so that users can save property values  
    // and edit them with a PropertyGridEditorPart control.
    [Personalizable(), WebBrowsable, WebDisplayName("Nickname")]
    public String NickName
    {
      get 
      { 
        object o = ViewState["NickName"];
        if (o != null)
          return (string)o;
        else
          return _userNickName;        
      } 

      set { _userNickName = server.HtmlEncode(value); }
    }

    [Personalizable(), WebBrowsable, WebDisplayName("Pet Name")]
    public String PetName
    {
      get 
      { 
        object o = ViewState["PetName"];
        if (o != null)
          return (string)o;
        else
          return _userPetName;        
      }

      set { _userPetName = server.HtmlEncode(value); }
    }

    [Personalizable(), WebBrowsable(), WebDisplayName("Special Day")]
    public DateTime SpecialDay
    {
      get
      {
        object o = ViewState["SpecialDay"];
        if (o != null)
          return (DateTime)o;
        else
          return _userSpecialDate;
        
      }

      set { _userSpecialDate = value; }
    }

    [Personalizable(), WebBrowsable(), WebDisplayName("Job Type")]
    public JobTypeName UserJobType
    {
      get
      {
        object o = ViewState["UserJobType"];
        if (o != null)
          return (JobTypeName)o;
        else
          return _userJobType;
      }

      set { _userJobType = (JobTypeName)value; }
    }

    [Personalizable(), WebBrowsable(), WebDisplayName("Is Current")]
    public Boolean IsCurrent
    {
      get
      {
        object o = ViewState["IsCurrent"];
        if (o != null)
          return (Boolean)o;
        else
          return _userIsCurrent;
      }

      set { _userIsCurrent = value; }
    }


    protected override void CreateChildControls()
    {
      Controls.Clear();

      NickNameLabel = new Label();
      NickNameLabel.Text = this.NickName;
      SetControlAttributes(NickNameLabel);

      PetNickNameLabel = new Label();
      PetNickNameLabel.Text = this.PetName;
      SetControlAttributes(PetNickNameLabel);

      SpecialDateLabel = new Label();
      SpecialDateLabel.Text = this.SpecialDay.ToShortDateString();
      SetControlAttributes(SpecialDateLabel);

      IsCurrentCheckBox = new CheckBox();
      IsCurrentCheckBox.Checked = this.IsCurrent;
      SetControlAttributes(IsCurrentCheckBox);

      JobTypeLabel = new Label();
      JobTypeLabel.Text = this.UserJobType.ToString();
      SetControlAttributes(JobTypeLabel);

      ChildControlsCreated = true;

    }

    private void SetControlAttributes(WebControl
 ctl)
    {
      ctl.BackColor = Color.White;
      ctl.BorderWidth = 1;
      ctl.Width = 200;
      this.Controls.Add(ctl);
    }

    protected override void RenderContents(HtmlTextWriter
 writer)
    {
      writer.Write("Nickname:");
      writer.WriteBreak();
      NickNameLabel.RenderControl(writer);
      writer.WriteBreak();
      writer.Write("Pet Name:");
      writer.WriteBreak();
      PetNickNameLabel.RenderControl(writer);
      writer.WriteBreak();
      writer.Write("Special Date:");
      writer.WriteBreak();
      SpecialDateLabel.RenderControl(writer);
      writer.WriteBreak();
      writer.Write("Job Type:");
      writer.WriteBreak();
      JobTypeLabel.RenderControl(writer);
      writer.WriteBreak();
      writer.Write("Current:");
      writer.WriteBreak();
      IsCurrentCheckBox.RenderControl(writer);
    }
  }


  [AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  [AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  public class TextDisplayWebPart : WebPart
  {
    private String _contentText = null;
    TextBox input;
    Label DisplayContent;
    Literal lineBreak;

    [Personalizable(), WebBrowsable]
    public String ContentText
    {
      get { return _contentText; }
      set { _contentText = value; }
    }

    protected override void CreateChildControls()
    {
      Controls.Clear();
      DisplayContent = new Label();
      DisplayContent.BackColor = Color.LightBlue;
      DisplayContent.Text = this.ContentText;
      this.Controls.Add(DisplayContent);

      lineBreak = new Literal();
      lineBreak.Text = @"<br />";
      Controls.Add(lineBreak);

      input = new TextBox();
      this.Controls.Add(input);
      Button update = new Button();
      update.Text = "Set Label Content";
      update.Click += new EventHandler(this.submit_Click);
      this.Controls.Add(update);

    }

    private void submit_Click(object sender,
 EventArgs e)
    {
      // Update the label string.
      if (!String.IsNullOrEmpty(input.Text))
      {
        _contentText = Context.Server.HtmlEncode(input.Text) + @"<br />";
        input.Text = String.Empty;
        DisplayContent.Text = this.ContentText;
      }
    }

  }

}

ここでコード例を実行してください。ブラウザに Web ページを読み込みます。最初の手順は、UserInfoWebPart コントロールの編集です。[Display Mode] ドロップダウン リスト コントロールを使用して [編集] を選択し、ページを編集モードに切り替えます。UserInfoWebPart コントロールの動詞メニュー (タイトル バーの下向きの矢印) をクリックし、[編集] をクリックします。編集用の UI が表示されると、いくつかの編集用コントロールが UserInfoWebPart コントロールの下に表示されます。これを使用して、このコントロールのフィールド値を編集できます。いくつかのフィールドを編集し、[OK] をクリックして、[Display Mode] ドロップダウン リストを使用してページをブラウズ モードに戻します。

2 番目の手順は、UserInfoWebPart コントロールの .WebPart 記述ファイルのエクスポートです。カスタム コントロールの動詞メニュー (タイトル バーの下向きの矢印で表されます) をクリックし、[エクスポート] をクリックします。指示に従って、コントロールの .WebPart 記述ファイルを保存します。ここで Web ページを閉じ、エディタでページ ソースを編集します。<aspSample:userinfowebpart> コントロールの宣言要素を削除し、ファイルを保存して閉じます。(この手順は、コントロールをページにインポートできるように、まだ UserInfoWebPart コントロールがないユーザーをシミュレートするために行います。)

ブラウザに再度 Web ページを読み込みます。UserInfoWebPart コントロールは削除したので表示されません。[Display Mode] ドロップダウン リスト コントロールを使用して [カタログ] を選択し、ページをカタログ モードに切り替えます。ImportCatalogPart コントロールで、[参照] ボタンをクリックし、作成した .WebPart ファイルを参照して、[アップロード] ボタンをクリックします。コントロールへの参照が、その隣のチェック ボックスと共に表示されます。チェック ボックスをオンにし、[追加] をクリックして、コントロールをページに追加します。

ページがこの表示状態になっている間に、ページの下部近くにある [Update ImportCatalogPart] ボタンをクリックして、ImportCatalogPart コントロールの多くのプロパティ値をプログラムによって更新する効果を確認してください。ボタンをクリックした後、さまざまなプロパティが UI でどのように変更されるかを確認してください。

最後に、[閉じる] をクリックしてカタログ モードを終了し、ページをブラウズ モードに戻します。UserInfoWebPart コントロールがページに表示されるようになり、以前にエクスポートしたときの値が格納されています。

.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.Panel
         System.Web.UI.WebControls.WebParts.Part
           System.Web.UI.WebControls.WebParts.CatalogPart
            System.Web.UI.WebControls.WebParts.ImportCatalogPart
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ImportCatalogPart コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

ImportCatalogPart クラスの新しいインスタンスを初期化します。

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As New ImportCatalogPart
public ImportCatalogPart ()
public:
ImportCatalogPart ()
public ImportCatalogPart ()
public function ImportCatalogPart ()
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ImportCatalogPart クラス
ImportCatalogPart メンバ
System.Web.UI.WebControls.WebParts 名前空間
その他の技術情報
ASP.NET Web パーツ ページ

ImportCatalogPart プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ AccessKey  Web サーバー コントロールにすばやく移動できるアクセス キーを取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ AppRelativeTemplateSourceDirectory  このコントロールが含まれている Page オブジェクトまたは UserControl オブジェクトのアプリケーション相対の仮想ディレクトリを取得または設定します。 ( Control から継承されます。)
パブリック プロパティ Attributes  コントロールのプロパティに対応しない任意の属性 (表示専用) のコレクションを取得します。 ( WebControl から継承されます。)
パブリック プロパティ BackColor  Web サーバー コントロールの背景色を取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ BackImageUrl  パネル コントロールの背景イメージの URL を取得または設定します。 ( Panel から継承されます。)
パブリック プロパティ BindingContainer  このコントロールのデータ バインディングを格納しているコントロールを取得します。 ( Control から継承されます。)
パブリック プロパティ BorderColor  Web コントロールの境界線の色を取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ BorderStyle  Web サーバー コントロールの境界線スタイルを取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ BorderWidth  Web サーバー コントロールの境界線の幅を取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ BrowseHelpText ユーザーに、記述ファイルの場所を参照するように指示するテキスト メッセージを取得または設定します。
パブリック プロパティ ChromeState  パーツ コントロールが最小化または標準のどちらの状態で表示されるかを示す値を取得または設定します。 ( Part から継承されます。)
パブリック プロパティ ChromeType  Web パーツ コントロールを囲む境界線の種類を取得または設定します。 ( Part から継承されます。)
パブリック プロパティ ClientID  ASP.NET によって生成されたサーバー コントロール ID を取得します。 ( Control から継承されます。)
パブリック プロパティ Controls  ユーザー インターフェイスの階層構造の指定されたサーバー コントロールの子コントロールを格納している ControlCollection オブジェクトを取得します。 ( Part から継承されます。)
パブリック プロパティ ControlStyle  Web サーバー コントロールのスタイルを取得します。このプロパティは、主にコントロールの開発者によって使用されます。 ( WebControl から継承されます。)
パブリック プロパティ ControlStyleCreated  Style オブジェクトが ControlStyle プロパティに対して作成されたかどうかを示す値を取得します。このプロパティは、主にコントロールの開発者によって使用されます。 ( WebControl から継承されます。)
パブリック プロパティ CssClass  クライアントで Web サーバー コントロールによって表示されるカスケード スタイル シート (CSS: Cascading Style Sheet) クラスを取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ DefaultButton オーバーライドされます。 ユーザー インターフェイス (UI) で、ボタンを含むフォームがレンダリングされるときにフォーカスを得る既定のボタンとして扱うボタンを取得または設定します。このプロパティは、ページ開発者コードから呼び出すためのものではありません。
パブリック プロパティ Description  パーツ コントロールのツールヒントやカタログで使用する、パーツ コントロールの動作をまとめた短い語句を取得または設定します。 ( Part から継承されます。)
パブリック プロパティ Direction  テキストを含むコントロールを Panel コントロールに表示する方向を取得または設定します。 ( Panel から継承されます。)
パブリック プロパティ DisplayTitle  CatalogPart コントロールの現在の実際のタイトルを含む文字列を取得します。 ( CatalogPart から継承されます。)
パブリック プロパティ Enabled  Web サーバー コントロールを有効にするかどうかを示す値を取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ EnableTheming  テーマがこのコントロールに適用されるかどうかを示す値を取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ EnableViewState  サーバー コントロールが、そのビューステートおよび格納している子コントロールのビューステートを、要求しているクライアントに永続化させるかどうかを示す値を取得または設定します。 ( Control から継承されます。)
パブリック プロパティ Font  Web サーバー コントロールに関連付けられたフォント プロパティを取得します。 ( WebControl から継承されます。)
パブリック プロパティ ForeColor  Web サーバー コントロールの前景色 (通常はテキストの色) を取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ GroupingText  パネル コントロールに格納されているコントロールのグループのキャプションを取得または設定します。 ( Panel から継承されます。)
パブリック プロパティ HasAttributes  コントロールに属性セットがあるかどうかを示す値を取得します。 ( WebControl から継承されます。)
パブリック プロパティ Height  Web サーバー コントロールの高さを取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ HorizontalAlign  パネルの内容の水平方向の配置を取得または設定します。 ( Panel から継承されます。)
パブリック プロパティ ID  サーバー コントロールに割り当てられたプログラム ID を取得または設定します。 ( Control から継承されます。)
パブリック プロパティ ImportedPartLabelText ユーザーが記述ファイルをインポートした後に表示されるテキストを取得または設定します。これは、インポートされたコントロールのカタログ内で個別のインポート済みコントロールを表現または説明するためのテキストです。
パブリック プロパティ NamingContainer  同じ Control.ID プロパティ値を持つ複数のサーバー コントロールを区別するための一意の名前空間を作成する、サーバー コントロールの名前付けコンテナへの参照を取得します。 ( Control から継承されます。)
パブリック プロパティ Page  サーバー コントロールを含んでいる Page インスタンスへの参照を取得します。 ( Control から継承されます。)
パブリック プロパティ Parent  ページ コントロールの階層構造における、サーバー コントロールの親コントロールへの参照を取得します。 ( Control から継承されます。)
パブリック プロパティ PartImportErrorLabelText インポート プロセスでエラーが発生した場合に表示されるエラー メッセージを取得または設定します。
パブリック プロパティ ScrollBars  Panel コントロールのスクロール バーの表示状態と位置を取得または設定します。 ( Panel から継承されます。)
パブリック プロパティ Site  デザイン サーフェイスに現在のコントロールを表示するときに、このコントロールをホストするコンテナに関する情報を取得します。 ( Control から継承されます。)
パブリック プロパティ SkinID  コントロールに適用するスキンを取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ Style  Web サーバー コントロールの外側のタグにスタイル属性として表示されるテキスト属性のコレクションを取得します。 ( WebControl から継承されます。)
パブリック プロパティ TabIndex  Web サーバー コントロールのタブ インデックスを取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ TemplateControl  このコントロールを格納しているテンプレートへの参照を取得または設定します。 ( Control から継承されます。)
パブリック プロパティ TemplateSourceDirectory  現在のサーバー コントロールを格納している Page または UserControl の仮想ディレクトリを取得します。 ( Control から継承されます。)
パブリック プロパティ Title オーバーライドされます。 ImportCatalogPart コントロールのタイトル バーに表示されるタイトルを取得または設定します。
パブリック プロパティ ToolTip  マウス ポインタが Web サーバー コントロールの上を移動したときに表示されるテキストを取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ UniqueID  階層構造で修飾されたサーバー コントロールの一意の ID を取得します。 ( Control から継承されます。)
パブリック プロパティ UploadButtonText 記述ファイルのアップロードを開始する Button コントロールのテキストを取得または設定します。
パブリック プロパティ UploadHelpText ユーザーに記述ファイルをアップロードする方法を通知するメッセージのテキストを取得または設定します。
パブリック プロパティ Visible  サーバー コントロールを UI としてページに表示するかどうかを示す値を取得または設定します。 ( Control から継承されます。)
パブリック プロパティ Width  Web サーバー コントロールの幅を取得または設定します。 ( WebControl から継承されます。)
パブリック プロパティ Wrap  パネルの内容をラップするかどうかを示す値を取得または設定します。 ( Panel から継承されます。)
参照参照

関連項目

ImportCatalogPart クラス
System.Web.UI.WebControls.WebParts 名前空間
PageCatalogPart
DeclarativeCatalogPart クラス

その他の技術情報

Web パーツ コントロール記述ファイル
ASP.NET Web パーツ ページ

ImportCatalogPart メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド ApplyStyle  指定したスタイルの空白以外の要素を Web コントロールにコピーして、コントロールの既存のスタイル要素を上書きします。このメソッドは、主にコントロールの開発者によって使用されます。 ( WebControl から継承されます。)
パブリック メソッド ApplyStyleSheetSkin  ページのスタイル シートに定義されたスタイル プロパティをコントロールに適用します。 ( Control から継承されます。)
パブリック メソッド CopyBaseAttributes  指定した Web サーバー コントロールから、Style オブジェクトでカプセル化されていないプロパティをこのメソッドの呼び出し元の Web サーバー コントロールにコピーします。このメソッドは、主にコントロールの開発者によって使用されます。 ( WebControl から継承されます。)
パブリック メソッド DataBind  ( Part から継承されます。)
パブリック メソッド Dispose  サーバー コントロールが、メモリから解放される前に最終的なクリーンアップを実行できるようにします。 ( Control から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド FindControl  指定した id パラメータを使用して、サーバー コントロールの現在の名前付けコンテナを検索します。 ( Control から継承されます。)
パブリック メソッド Focus  コントロールに入力フォーカスを設定します。 ( Control から継承されます。)
パブリック メソッド GetAvailableWebPartDescriptions オーバーライドされます。 カタログ内で利用できる WebPart コントロールの説明のコレクションを返します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド GetWebPart オーバーライドされます。 メソッドに渡される説明の値に基づいて、WebPart コントロールへの参照を返します。
パブリック メソッド HasControls  サーバー コントロールに子コントロールが含まれているかどうかを確認します。 ( Control から継承されます。)
パブリック メソッド MergeStyle  指定したスタイルの空白以外の要素を Web コントロールにコピーしますが、コントロールの既存のスタイル要素は上書きしません。このメソッドは、主にコントロールの開発者によって使用されます。 ( WebControl から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド RenderBeginTag  Panel コントロールの HTML 開始タグを指定したライタに表示します。 ( Panel から継承されます。)
パブリック メソッド RenderControl  提供された HtmlTextWriter オブジェクトにサーバー コントロールの内容を出力し、トレースが有効である場合はコントロールに関するトレース情報を格納します。 ( Control から継承されます。)
パブリック メソッド RenderEndTag  Panel コントロールの HTML 終了タグを指定したライタに表示します。 ( Panel から継承されます。)
パブリック メソッド ResolveClientUrl  ブラウザで使用できる URL を取得します。 ( Control から継承されます。)
パブリック メソッド ResolveUrl  要求側クライアントで使用できる URL に変換します。 ( Control から継承されます。)
パブリック メソッド SetRenderMethodDelegate  サーバー コントロールとその内容を親コントロールに表示するイベント ハンドラ デリゲートを割り当てます。 ( Control から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ImportCatalogPart クラス
System.Web.UI.WebControls.WebParts 名前空間
PageCatalogPart
DeclarativeCatalogPart クラス

その他の技術情報

Web パーツ コントロール記述ファイル
ASP.NET Web パーツ ページ

ImportCatalogPart メンバ

あらかじめ定義した設定でコントロールを Web ページに追加できるように、WebPart コントロール (または WebPart コントロールとして使用される他の ASP.NET サーバー コントロール) の記述ファイルをインポートします。このクラスは継承できません。

ImportCatalogPart データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ImportCatalogPart ImportCatalogPart クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ AccessKey  Web サーバー コントロールにすばやく移動できるアクセス キーを取得または設定します。(WebControl から継承されます。)
パブリック プロパティ AppRelativeTemplateSourceDirectory  このコントロールが含まれている Page オブジェクトまたは UserControl オブジェクトのアプリケーション相対の仮想ディレクトリを取得または設定します。(Control から継承されます。)
パブリック プロパティ Attributes  コントロールのプロパティに対応しない任意の属性 (表示専用) のコレクションを取得します。(WebControl から継承されます。)
パブリック プロパティ BackColor  Web サーバー コントロールの背景色を取得または設定します。(WebControl から継承されます。)
パブリック プロパティ BackImageUrl  パネル コントロールの背景イメージの URL を取得または設定します。(Panel から継承されます。)
パブリック プロパティ BindingContainer  このコントロールのデータ バインディングを格納しているコントロールを取得します。(Control から継承されます。)
パブリック プロパティ BorderColor  Web コントロールの境界線の色を取得または設定します。(WebControl から継承されます。)
パブリック プロパティ BorderStyle  Web サーバー コントロールの境界線スタイルを取得または設定します。(WebControl から継承されます。)
パブリック プロパティ BorderWidth  Web サーバー コントロールの境界線の幅を取得または設定します。(WebControl から継承されます。)
パブリック プロパティ BrowseHelpText ユーザーに、記述ファイルの場所を参照するように指示するテキスト メッセージを取得または設定します。
パブリック プロパティ ChromeState  パーツ コントロールが最小化または標準のどちらの状態で表示されるかを示す値を取得または設定します。(Part から継承されます。)
パブリック プロパティ ChromeType  Web パーツ コントロールを囲む境界線の種類を取得または設定します。(Part から継承されます。)
パブリック プロパティ ClientID  ASP.NET によって生成されたサーバー コントロール ID を取得します。(Control から継承されます。)
パブリック プロパティ Controls  ユーザー インターフェイスの階層構造の指定されたサーバー コントロールの子コントロールを格納している ControlCollection オブジェクトを取得します。(Part から継承されます。)
パブリック プロパティ ControlStyle  Web サーバー コントロールのスタイルを取得します。このプロパティは、主にコントロールの開発者によって使用されます。(WebControl から継承されます。)
パブリック プロパティ ControlStyleCreated  Style オブジェクトが ControlStyle プロパティに対して作成されたかどうかを示す値を取得します。このプロパティは、主にコントロールの開発者によって使用されます。(WebControl から継承されます。)
パブリック プロパティ CssClass  クライアントで Web サーバー コントロールによって表示されるカスケード スタイル シート (CSS: Cascading Style Sheet) クラスを取得または設定します。(WebControl から継承されます。)
パブリック プロパティ DefaultButton オーバーライドされます。 ユーザー インターフェイス (UI) で、ボタンを含むフォームがレンダリングされるときにフォーカスを得る既定のボタンとして扱うボタンを取得または設定します。このプロパティは、ページ開発者コードから呼び出すためのものではありません。
パブリック プロパティ Description  パーツ コントロールのツールヒントやカタログで使用する、パーツ コントロールの動作をまとめた短い語句を取得または設定します。(Part から継承されます。)
パブリック プロパティ Direction  テキストを含むコントロールを Panel コントロールに表示する方向を取得または設定します。(Panel から継承されます。)
パブリック プロパティ DisplayTitle  CatalogPart コントロールの現在の実際のタイトルを含む文字列を取得します。(CatalogPart から継承されます。)
パブリック プロパティ Enabled  Web サーバー コントロールを有効にするかどうかを示す値を取得または設定します。(WebControl から継承されます。)
パブリック プロパティ EnableTheming  テーマがこのコントロールに適用されるかどうかを示す値を取得または設定します。(WebControl から継承されます。)
パブリック プロパティ EnableViewState  サーバー コントロールが、そのビューステートおよび格納している子コントロールのビューステートを、要求しているクライアントに永続化させるかどうかを示す値を取得または設定します。(Control から継承されます。)
パブリック プロパティ Font  Web サーバー コントロールに関連付けられたフォント プロパティを取得します。(WebControl から継承されます。)
パブリック プロパティ ForeColor  Web サーバー コントロールの前景色 (通常はテキストの色) を取得または設定します。(WebControl から継承されます。)
パブリック プロパティ GroupingText  パネル コントロールに格納されているコントロールのグループのキャプションを取得または設定します。(Panel から継承されます。)
パブリック プロパティ HasAttributes  コントロールに属性セットがあるかどうかを示す値を取得します。(WebControl から継承されます。)
パブリック プロパティ Height  Web サーバー コントロールの高さを取得または設定します。(WebControl から継承されます。)
パブリック プロパティ HorizontalAlign  パネルの内容の水平方向の配置を取得または設定します。(Panel から継承されます。)
パブリック プロパティ ID  サーバー コントロールに割り当てられたプログラム ID を取得または設定します。(Control から継承されます。)
パブリック プロパティ ImportedPartLabelText ユーザーが記述ファイルをインポートした後に表示されるテキストを取得または設定します。これは、インポートされたコントロールのカタログ内で個別のインポート済みコントロールを表現または説明するためのテキストです。
パブリック プロパティ NamingContainer  同じ Control.ID プロパティ値を持つ複数のサーバー コントロールを区別するための一意の名前空間を作成する、サーバー コントロールの名前付けコンテナへの参照を取得します。(Control から継承されます。)
パブリック プロパティ Page  サーバー コントロールを含んでいる Page インスタンスへの参照を取得します。(Control から継承されます。)
パブリック プロパティ Parent  ページ コントロールの階層構造における、サーバー コントロールの親コントロールへの参照を取得します。(Control から継承されます。)
パブリック プロパティ PartImportErrorLabelText インポート プロセスでエラーが発生した場合に表示されるエラー メッセージを取得または設定します。
パブリック プロパティ ScrollBars  Panel コントロールのスクロール バーの表示状態と位置を取得または設定します。(Panel から継承されます。)
パブリック プロパティ Site  デザイン サーフェイスに現在のコントロールを表示するときに、このコントロールをホストするコンテナに関する情報を取得します。(Control から継承されます。)
パブリック プロパティ SkinID  コントロールに適用するスキンを取得または設定します。(WebControl から継承されます。)
パブリック プロパティ Style  Web サーバー コントロールの外側のタグにスタイル属性として表示されるテキスト属性のコレクションを取得します。(WebControl から継承されます。)
パブリック プロパティ TabIndex  Web サーバー コントロールのタブ インデックスを取得または設定します。(WebControl から継承されます。)
パブリック プロパティ TemplateControl  このコントロールを格納しているテンプレートへの参照を取得または設定します。 (Control から継承されます。)
パブリック プロパティ TemplateSourceDirectory  現在のサーバー コントロールを格納している Page または UserControl の仮想ディレクトリを取得します。(Control から継承されます。)
パブリック プロパティ Title オーバーライドされます。 ImportCatalogPart コントロールのタイトル バーに表示されるタイトルを取得または設定します。
パブリック プロパティ ToolTip  マウス ポインタが Web サーバー コントロールの上を移動したときに表示されるテキストを取得または設定します。(WebControl から継承されます。)
パブリック プロパティ UniqueID  階層構造で修飾されたサーバー コントロールの一意の ID を取得します。(Control から継承されます。)
パブリック プロパティ UploadButtonText 記述ファイルのアップロードを開始する Button コントロールのテキストを取得または設定します。
パブリック プロパティ UploadHelpText ユーザーに記述ファイルをアップロードする方法を通知するメッセージのテキストを取得または設定します。
パブリック プロパティ Visible  サーバー コントロールを UI としてページに表示するかどうかを示す値を取得または設定します。(Control から継承されます。)
パブリック プロパティ Width  Web サーバー コントロールの幅を取得または設定します。(WebControl から継承されます。)
パブリック プロパティ Wrap  パネルの内容をラップするかどうかを示す値を取得または設定します。(Panel から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド ApplyStyle  指定したスタイルの空白以外の要素を Web コントロールにコピーして、コントロールの既存のスタイル要素を上書きします。このメソッドは、主にコントロールの開発者によって使用されます。 (WebControl から継承されます。)
パブリック メソッド ApplyStyleSheetSkin  ページのスタイル シートに定義されたスタイル プロパティをコントロールに適用します。 (Control から継承されます。)
パブリック メソッド CopyBaseAttributes  指定した Web サーバー コントロールから、Style オブジェクトでカプセル化されていないプロパティをこのメソッドの呼び出し元の Web サーバー コントロールにコピーします。このメソッドは、主にコントロールの開発者によって使用されます。 (WebControl から継承されます。)
パブリック メソッド DataBind  ( Part から継承されます。)
パブリック メソッド Dispose  サーバー コントロールが、メモリから解放される前に最終的なクリーンアップを実行できるようにします。 (Control から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド FindControl  指定した id パラメータを使用して、サーバー コントロールの現在の名前付けコンテナを検索します。 (Control から継承されます。)
パブリック メソッド Focus  コントロールに入力フォーカスを設定します。 (Control から継承されます。)
パブリック メソッド GetAvailableWebPartDescriptions オーバーライドされます。 カタログ内で利用できる WebPart コントロールの説明のコレクションを返します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド GetWebPart オーバーライドされます。 メソッドに渡される説明の値に基づいて、WebPart コントロールへの参照を返します。
パブリック メソッド HasControls  サーバー コントロールに子コントロールが含まれているかどうかを確認します。 (Control から継承されます。)
パブリック メソッド MergeStyle  指定したスタイルの空白以外の要素を Web コントロールにコピーしますが、コントロールの既存のスタイル要素は上書きしません。このメソッドは、主にコントロールの開発者によって使用されます。 (WebControl から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド RenderBeginTag  Panel コントロールの HTML 開始タグを指定したライタに表示します。 (Panel から継承されます。)
パブリック メソッド RenderControl  提供された HtmlTextWriter オブジェクトにサーバー コントロールの内容を出力し、トレースが有効である場合はコントロールに関するトレース情報を格納します。 (Control から継承されます。)
パブリック メソッド RenderEndTag  Panel コントロールの HTML 終了タグを指定したライタに表示します。 (Panel から継承されます。)
パブリック メソッド ResolveClientUrl  ブラウザで使用できる URL を取得します。 (Control から継承されます。)
パブリック メソッド ResolveUrl  要求側クライアントで使用できる URL に変換します。 (Control から継承されます。)
パブリック メソッド SetRenderMethodDelegate  サーバー コントロールとその内容を親コントロールに表示するイベント ハンドラ デリゲートを割り当てます。 (Control から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
参照参照

関連項目

ImportCatalogPart クラス
System.Web.UI.WebControls.WebParts 名前空間
PageCatalogPart
DeclarativeCatalogPart クラス

その他の技術情報

Web パーツ コントロール記述ファイル
ASP.NET Web パーツ ページ



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「ImportCatalogPart」の関連用語

ImportCatalogPartのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ImportCatalogPartのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS