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

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

StateBag.IsItemDirty メソッド

StateBag オブジェクト格納されている StateItem オブジェクトチェックして、Control.TrackViewState への呼び出し以降にそのオブジェクト変更されたかどうかを評価します

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

Public Function IsItemDirty ( _
    key As String _
) As Boolean
Dim instance As StateBag
Dim key As String
Dim returnValue As Boolean

returnValue = instance.IsItemDirty(key)
public bool IsItemDirty (
    string key
)
public:
bool IsItemDirty (
    String^ key
)
public boolean IsItemDirty (
    String key
)
public function IsItemDirty (
    key : String
) : boolean

パラメータ

key

チェックする項目のキー

戻り値
項目が変更され場合trueそれ以外場合false

解説解説
使用例使用例

IsItemDirty メソッド使用するコード例次に示します

' Implement the SaveViewState method. If the StateBag
' that stores the MyItem class's view state contains
' a value for the message property and if the value
' has changed since the TrackViewState method was last 
' called, all view state for this class is deleted, 
' using the StateBag.Clear method,and the new value is added.
Function SaveViewState() As Object
 Implements IStateManager.SaveViewState
    ' Check whether the message property exists in 
    ' the ViewState property, and if it does, check
    ' whether it has changed since the most recent
    ' TrackViewState method call.
    If Not CType(_viewstate, IDictionary).Contains("message")
 OrElse _viewstate.IsItemDirty("message")
 Then
        _viewstate.Clear()
        ' Add the _message property to the StateBag.
        _viewstate.Add("message", _message)
    End If
    Return CType(_viewstate, IStateManager).SaveViewState()
End Function 'IStateManager.SaveViewState


// Implement the SaveViewState method. If the StateBag
// that stores the MyItem class's view state contains
// a value for the message property and if the value
// has changed since the TrackViewState method was last 
// called, all view state for this class is deleted, 
// using the StateBag.Clear method,and the new value is added.
object IStateManager.SaveViewState()
{
    // Check whether the message property exists in 
    // the ViewState property, and if it does, check
    // whether it has changed since the most recent
    // TrackViewState method call.
    if (!((IDictionary)_viewstate).Contains("message")
 || _viewstate.IsItemDirty("message"))
    {
        _viewstate.Clear();
        // Add the _message property to the StateBag.
        _viewstate.Add("message", _message);
    }
    return ((IStateManager)_viewstate).SaveViewState();
}

// Implement the SaveViewState method. If the StateBag
// that stores the MyItem class's view state contains
// a value for the message property and if the value
// has changed since the TrackViewState method was last 
// called, all view state for this class is deleted, 
// using the StateBag.Clear method,and the new value is added.
public Object SaveViewState()
{
    // Check whether the message property exists in 
    // the ViewState property, and if it does, check
    // whether it has changed since the most recent
    // TrackViewState method call.
    if (!(((IDictionary)_viewState).Contains("message"))
 
        || _viewState.IsItemDirty("message")) {
        {
            _viewState.Clear();
            // Add the _message property to the StateBag.
            _viewState.Add("message", _message);
        }
    }
    return ((IStateManager)_viewState).SaveViewState();
} //SaveViewState
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
StateBag クラス
StateBag メンバ
System.Web.UI 名前空間
Control.ViewState プロパティ



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS