System.Web.UI.WebControls.FormParameter Class

Binds the value of an HTTP request System.Web.HttpRequest.Form field to a parameter object.

See Also: FormParameter Members


public class FormParameter : Parameter


You can use the System.Web.UI.WebControls.FormParameter class to bind the value of a form variable in the System.Web.HttpRequest.Form collection to a parameter used in a parameterized query or command. Controls that bind data to the parameter might throw an exception if a System.Web.UI.WebControls.FormParameter is specified but no corresponding form variable is passed. They might also display no data if the form variable is passed with no corresponding value. Set the Parameter.DefaultValue to avoid these situations where appropriate.

The System.Web.UI.WebControls.FormParameter class provides the FormParameter.FormField property, which identifies the name of the form variable to bind to, in addition to those inherited from the System.Web.UI.WebControls.Parameter class.


The System.Web.UI.WebControls.FormParameter does not validate the value passed by the form element in any way; it uses the raw value. In most cases you can validate the value of the System.Web.UI.WebControls.FormParameter before it is used by a data source control by handling an event, such as the Selecting, Updating, Inserting, or Deleting event exposed by the data source control you are using. If the value of the parameter does not pass your validation tests, you can cancel the data operation by setting the System.ComponentModel.CancelEventArgs.Cancel property of the associated System.ComponentModel.CancelEventArgs class to true.


Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0