EditorPart.ApplyChanges メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EditorPart.ApplyChanges メソッドの意味・解説 

EditorPart.ApplyChanges メソッド

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

EditorPart コントロールの値を、関連付けられている WebPart コントロールの対応するプロパティに保存します。

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

解説解説
使用例使用例

カスタム EditorPart コントロールで ApplyChanges メソッドを実装する方法を次のコード例に示します。例の実行に必要なコード全体については、EditorPart クラスの概要で「例」を参照してください。

コード例の最初の部分は、TextDisplayEditorPart という名前のカスタム EditorPart クラスでの ApplyChanges メソッドの実装を示します。このメソッドは、WebPartToEdit プロパティを使用して、関連付けられている TextDisplayWebPart コントロールへの参照を取得します。次に、TextDisplayWebPart.FontStyle プロパティの値を更新します。

Public Overrides Function
 ApplyChanges() As Boolean
  Dim part As TextDisplayWebPart = CType(WebPartToEdit,
 _
                                         TextDisplayWebPart)
  ' Update the custom WebPart control with the font style.
  part.FontStyle = PartContentFontStyle.SelectedValue

  Return True

End Function
public override bool ApplyChanges()
{
  TextDisplayWebPart part = 
    (TextDisplayWebPart)WebPartToEdit;
  // Update the custom WebPart control with the font style.
  part.FontStyle = PartContentFontStyle.SelectedValue;

  return true;
}

コード例の 2 番目の部分は、関連付けられている WebPart コントロール TextDisplayWebPart が、関連付けられている EditorPart コントロールのコレクション (この場合、コレクションには TextDisplayEditorPart という名前の EditorPart コントロールが 1 つだけ含まれる) をその CreateEditorParts メソッドの実装に作成する方法を示します。このメソッドは、TextDisplayWebPart コントロールが編集モードになったときに実行されます。

Public Overrides Function
 CreateEditorParts() _
                            As EditorPartCollection
  Dim editorArray As New
 ArrayList()
  Dim edPart as New TextDisplayEditorPart()
  edPart.ID = Me.ID & "_editorPart1"
  editorArray.Add(edPart)
  Dim editorParts As New
 EditorPartCollection(editorArray)
  Return editorParts

End Function

Public Overrides ReadOnly
 Property WebBrowsableObject() _
                                    As Object
  Get
    Return Me
  End Get
End Property
public override EditorPartCollection CreateEditorParts()
{
  ArrayList editorArray = new ArrayList();
  TextDisplayEditorPart edPart = new TextDisplayEditorPart();
  edPart.ID = this.ID + "_editorPart1";
  editorArray.Add(edPart);
  EditorPartCollection editorParts = 
    new EditorPartCollection(editorArray);
  return editorParts;
}

public override object WebBrowsableObject
{
  get { return this; }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EditorPart クラス
EditorPart メンバ
System.Web.UI.WebControls.WebParts 名前空間
SyncChanges
IWebEditable
その他の技術情報
ASP.NET Web パーツ ページ



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「EditorPart.ApplyChanges メソッド」の関連用語

EditorPart.ApplyChanges メソッドのお隣キーワード
検索ランキング

   

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



EditorPart.ApplyChanges メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS