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

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

Page.RegisterRequiresControlState メソッド

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

特定のコントロールを、コントロールの状態維持する必要があるコントロールとして登録します

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

Public Sub RegisterRequiresControlState ( _
    control As Control _
)
Dim instance As Page
Dim control As Control

instance.RegisterRequiresControlState(control)
public void RegisterRequiresControlState (
    Control control
)
public:
void RegisterRequiresControlState (
    Control^ control
)
public void RegisterRequiresControlState (
    Control control
)
public function RegisterRequiresControlState
 (
    control : Control
)

パラメータ

control

登録するコントロール

例外例外
例外種類条件

ArgumentException

登録するコントロールnull 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

RegisterRequiresControlState メソッド呼び出すカスタム サーバー コントロール次のコード例示します

Class Sample
  Inherits Control
  
  Dim currentIndex As Integer
  
  Overloads Sub OnInit(ByVal
 e As EventArgs)
    Page.RegisterRequiresControlState(Me)
    currentIndex = 0
    
    MyBase.OnInit(e)
  End Sub
  
  Overloads Function SaveControlState() As
 Object
    If currentIndex <> 0 Then
      Return CType(currentIndex, Object)
    Else
      Return Nothing
    End If
  End Function
  
  Overloads Sub LoadControlState(ByVal
 state As Object)
    If (state <> Nothing) Then
      currentIndex = CType(state, Integer)
    End If
  End Sub
  
End Class
public class Sample : Control {
    private int currentIndex = 0;
   
    protected override void OnInit(EventArgs
 e) {
        Page.RegisterRequiresControlState(this);
        base.OnInit(e);
    }

    protected override object SaveControlState() {
        return currentIndex != 0 ? (object)currentIndex : null;
    }

    protected override void LoadControlState(object
 state) {
        if (state != null) {
            currentIndex = (int)state;
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Page クラス
Page メンバ
System.Web.UI 名前空間
RequiresControlState



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Page.RegisterRequiresControlState メソッド」の関連用語

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

   

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



Page.RegisterRequiresControlState メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS