Επεξεργασία

Κοινή χρήση μέσω


IPostBackDataHandler.LoadPostData(String, NameValueCollection) Method

Definition

When implemented by a class, processes postback data for an ASP.NET server control.

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

Parameters

postDataKey
String

The key identifier for the control.

postCollection
NameValueCollection

The collection of all incoming name values.

Returns

true if the server control's state changes as a result of the postback; otherwise, false.

Examples

The following code example demonstrates a server control that implements a version of the LoadPostData method.

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

Remarks

The ASP.NET page framework tracks all the server controls that return true to this method call, and then invokes the RaisePostDataChangedEvent method on those controls.

Applies to

See also