Parameter.Evaluate(HttpContext, Control) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Updates and returns the value of the Parameter object.
protected:
virtual System::Object ^ Evaluate(System::Web::HttpContext ^ context, System::Web::UI::Control ^ control);
protected public:
virtual System::Object ^ Evaluate(System::Web::HttpContext ^ context, System::Web::UI::Control ^ control);
protected virtual object Evaluate (System.Web.HttpContext context, System.Web.UI.Control control);
protected internal virtual object Evaluate (System.Web.HttpContext context, System.Web.UI.Control control);
abstract member Evaluate : System.Web.HttpContext * System.Web.UI.Control -> obj
override this.Evaluate : System.Web.HttpContext * System.Web.UI.Control -> obj
Protected Overridable Function Evaluate (context As HttpContext, control As Control) As Object
Protected Friend Overridable Function Evaluate (context As HttpContext, control As Control) As Object
Parameters
- context
- HttpContext
The current HttpContext of the request.
- control
- Control
The Control the parameter is bound to. If the parameter is not bound to a control, the control
parameter is ignored.
Returns
An object
that represents the updated and current value of the parameter.
Examples
The following code example demonstrates how to override the Evaluate method to return the correct value in a class that is derived from the Parameter class. This code example is part of a larger example provided for the Parameter class overview.
// The Evaluate method is overridden to return the
// DataValue property instead of the DefaultValue.
protected override object Evaluate(HttpContext context, Control control) {
if (context.Request == null)
return null;
return DataValue;
}
' The Evaluate method is overridden to return the
' DataValue property instead of the DefaultValue.
Protected Overrides Function Evaluate(context As HttpContext, control As Control) As Object
If context Is Nothing Then
Return Nothing
Else
Return DataValue
End If
End Function
Remarks
The default implementation of the Evaluate method is to return null
in all cases. Classes that derive from the Parameter class override the Evaluate method to return an updated parameter value. For example, the ControlParameter object returns the value of the control that it is bound to, while the QueryStringParameter object retrieves the current name/value pair from the HttpRequest object.
Applies to
.NET