IPostBackDataHandler.LoadPostData(String, NameValueCollection) Método

Definición

Cuando se implementa mediante una clase, se procesan los datos devueltos para un control de servidor 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

Parámetros

postDataKey
String

Identificador de clave del control.

postCollection
NameValueCollection

Colección de todos los valores de nombre entrantes.

Devoluciones

Boolean

true si el estado del control del servidor cambió a consecuencia del postback; en caso contrario, false.

Ejemplos

En el ejemplo de código siguiente se muestra un control de servidor que implementa una versión del LoadPostData método .

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

Comentarios

El marco de ASP.NET página realiza un seguimiento de todos los controles de servidor que vuelven true a esta llamada de método y, a continuación, invoca el RaisePostDataChangedEvent método en esos controles.

Se aplica a

Consulte también