共用方式為


IPostBackDataHandler.LoadPostData(String, NameValueCollection) 方法

定義

在類別實作時,處理 ASP.NET 伺服器控制項的回傳資料。

public:
 bool LoadPostData(System::String ^ postDataKey, System::Collections::Specialized::NameValueCollection ^ postCollection);
public bool LoadPostData (string postDataKey, System.Collections.Specialized.NameValueCollection postCollection);
abstract member LoadPostData : string * System.Collections.Specialized.NameValueCollection -> bool
Public Function LoadPostData (postDataKey As String, postCollection As NameValueCollection) As Boolean

參數

postDataKey
String

控制項的索引鍵識別項。

postCollection
NameValueCollection

所有內送名稱值的集合。

傳回

如果伺服器控制項的狀態因回傳而變更,則為 true,否則為 false

範例

下列程式代碼範例示範實作 方法版本的 LoadPostData 伺服器控制件。

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 Overridable Function LoadPostData(postDataKey As String, _
   postCollection As NameValueCollection) As Boolean
       
    Dim presentValue As String = Text
    Dim postedValue As String = postCollection(postDataKey)
       
    If (presentValue Is Nothing) OrElse (Not presentValue.Equals(postedValue)) Then 
        Text = postedValue
        Return True
    End If
    Return False
End Function

備註

ASP.NET 頁面架構會追蹤傳回 true 這個方法呼叫的所有伺服器控件,然後在這些控件上叫用 RaisePostDataChangedEvent 方法。

適用於

另請參閱