This documentation is archived and is not being maintained.

IPostBackDataHandler.LoadPostData Method

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

[Visual Basic]
Function LoadPostData( _
   ByVal postDataKey As String, _
   ByVal postCollection As NameValueCollection _
) As Boolean
bool LoadPostData(
   string postDataKey,
 NameValueCollection postCollection
bool LoadPostData(
   String* postDataKey,
 NameValueCollection* postCollection
function LoadPostData(
   postDataKey : String,
 postCollection : NameValueCollection
) : Boolean;


The key identifier for the control.
The collection of all incoming name values.

Return Value

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


The Web Forms page framework tracks all the server control's that return true to this method call, then invokes the RaisePostDataChangedEvent on those controls.


[Visual Basic, C#, C++] The following example demonstrates a server control implementing a version of the LoadPostData method.

[Visual Basic] 
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 Or Not presentValue.Equals(postedValue) Then 
        Text = postedValue
        Return True
    End If
    Return False
End Function

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;

 virtual bool LoadPostData(String* postDataKey,
    NameValueCollection* postCollection) {

    String* presentValue = Text;
    String* postedValue = postCollection->Item[postDataKey];

    if (presentValue == 0 || !presentValue->Equals(postedValue)){
       Text = postedValue;
       return true;
    return false;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

IPostBackDataHandler Interface | IPostBackDataHandler Members | System.Web.UI Namespace | Processing Postback Data