WebPartChrome.WebPartManager プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebPartChrome.WebPartManager プロパティの意味・解説 

WebPartChrome.WebPartManager プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

現在の WebPartManager インスタンスへの参照を取得します。

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

Protected ReadOnly Property
 WebPartManager As WebPartManager
Dim value As WebPartManager

value = Me.WebPartManager
protected WebPartManager WebPartManager { get;
 }
protected:
property WebPartManager^ WebPartManager {
    WebPartManager^ get ();
}
/** @property */
protected WebPartManager get_WebPartManager ()
protected function get WebPartManager
 () : WebPartManager

プロパティ値
Web ページ上の現在の WebPartManager への参照。

解説解説

ページ上の現在の WebPartManager への参照を提供する WebPartManager プロパティ。

使用例使用例

WebPartManager プロパティを使用する方法を次のコード例に示します。例の実行に必要なコード全体については、WebPartChrome クラスの概要のトピックで「例」を参照してください。

WebPartManager プロパティを使用して、現在表示されている WebPart コントロールが選択されたコントロールであるかどうか、つまりこの例では、ページがエディット ビューになっていて、コントロールが現在編集中であるかどうかを確認するコード例を次に示します。これらの条件が満たされている場合、コントロールの本体は表示されず、その場所には特定の文字列が書き込まれます。

Protected Overrides Sub
 RenderPartContents _
  (ByVal writer As HtmlTextWriter, ByVal
 part As WebPart)

  If part Is Me.WebPartManager.SelectedWebPart
 Then
    HttpContext.Current.Response.Write("<span>Not rendered</span>")
  Else
    If (Me.Zone.GetType() Is
 GetType(MyZone)) Then
      part.RenderControl(writer)
    End If
  End If

End Sub
protected override void RenderPartContents(HtmlTextWriter
 writer, 
  WebPart part)
{

    if (part == this.WebPartManager.SelectedWebPart)
      HttpContext.Current.Response.Write("<span>Not rendered</span>");
    else
      if(this.Zone.GetType() == typeof(MyZone))
        part.RenderControl(writer);
}

ブラウザで Web ページを読み込む場合、[Display Mode] ドロップダウン リスト コントロールで [編集] を選択することにより、ページを編集モードに切り替えることができます。いずれかのコントロールの動詞メニューで編集動詞をクリックできます。ページが表示されても、編集用に選択したコントロールの本体は表示されません。ただし、コントロールを [WebPartZone2] という名前のラベルが付いた空のゾーンにドラッグすると、コントロールの本体が表示されます。これは、2 番目のゾーンが標準 WebPartZone ゾーンであり、 WebPart コントロールを表示するのに、この例のカスタムの WebPartChrome クラスを使用しないためです。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebPartChrome クラス
WebPartChrome メンバ
System.Web.UI.WebControls.WebParts 名前空間
WebPartManager
その他の技術情報
ASP.NET Web パーツ ページ



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

WebPartChrome.WebPartManager プロパティのお隣キーワード
検索ランキング

   

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



WebPartChrome.WebPartManager プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS