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

IPostBackDataHandler インターフェイス

ポストバック データ自動的に読み込むために ASP.NET サーバー コントロール実装する必要があるメソッド定義します

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

Public Interface IPostBackDataHandler
Dim instance As IPostBackDataHandler
public interface IPostBackDataHandler
public interface class IPostBackDataHandler
public interface IPostBackDataHandler
public interface IPostBackDataHandler
解説解説
使用例使用例

IPostBackDataHandler インターフェイス実装するカスタム テキスト ボックス サーバー コントロールコード例次に示しますポストバック結果Text プロパティ変更されサーバー コントロールは、ポストバック データ読み込まれた後に TextChanged イベント発生させます

Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Collections
Imports System.Collections.Specialized

Namespace CustomWebFormsControls
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> Public
 Class MyTextBox
        Inherits Control
        Implements IPostBackDataHandler
        
        
        Public Property Text() As
 String
            Get
                Return CType(Me.ViewState("Text"),
 String)
            End Get
            
            Set
                Me.ViewState("Text")
 = value
            End Set
        End Property
        
        
        Public Event TextChanged As
 EventHandler
        
        
        Public Overridable Shadows
 Function LoadPostData( _
        postDataKey As String, _
        postCollection As System.Collections.Specialized.NameValueCollection)
 _
        As Boolean Implements
 IPostBackDataHandler.LoadPostData
            
            Dim presentValue As String
 = Text
            Dim postedValue As String
 = postCollection(postDataKey)
            
            If presentValue Is Nothing
 Or Not presentValue.Equals(postedValue) Then
                Text = postedValue
                Return True
            End If
            
            Return False
        End Function
        
        
        Public Overridable Shadows
 Sub RaisePostDataChangedEvent() _
        Implements IPostBackDataHandler.RaisePostDataChangedEvent
        
            OnTextChanged(EventArgs.Empty)
        End Sub
        
        
        Protected Overridable Sub
 OnTextChanged(e As EventArgs)
            RaiseEvent TextChanged(Me, e)
        End Sub
        
        
        Protected Overrides Sub
 Render(output As HtmlTextWriter)
            output.Write("<INPUT type= text name = "
 & Me.UniqueID & _
                " value = " & Me.Text
 & " >")
        End Sub
        
    End Class
    
End Namespace

using System;
using System.Web;
using System.Web.UI;
using System.Collections;
using System.Collections.Specialized;


namespace CustomWebFormsControls {

   [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name="FullTrust")] 
   public class MyTextBox: Control, IPostBackDataHandler
 {
    

      public String Text {
         get {
            return (String) ViewState["Text"];
         }

         set {
            ViewState["Text"] = value;
         }
      }      
      

      public event EventHandler TextChanged;
      

      public virtual bool LoadPostData(string
 postDataKey, 
         NameValueCollection postCollection) {

         String presentValue = Text;
         String postedValue = postCollection[postDataKey];

         if (presentValue == null || !presentValue.Equals(postedValue))
 {
            Text = postedValue;
            return true;
         }

         return false;
      }

      
      public virtual void RaisePostDataChangedEvent()
 {
         OnTextChanged(EventArgs.Empty);
      }
      

      protected virtual void OnTextChanged(EventArgs
 e) {
         if (TextChanged != null)
            TextChanged(this,e);
      }
      

      protected override void Render(HtmlTextWriter
 output) {
         output.Write("<INPUT type= text name = "+this.UniqueID
            + " value = " + this.Text + " >");
      }
   }   
}
   
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

IPostBackDataHandler メソッド


IPostBackDataHandler メンバ



このページでは「.NET Framework クラス ライブラリ リファレンス」からIPostBackDataHandlerを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIPostBackDataHandlerを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIPostBackDataHandler を検索

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

辞書ショートカット

すべての辞書の索引

「IPostBackDataHandler」の関連用語











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

   

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



IPostBackDataHandlerのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS