SessionParameter Class
Binds the value of a session variable to a parameter object.
Assembly: System.Web (in System.Web.dll)
| Name | Description | |
|---|---|---|
![]() | SessionParameter() | Initializes a new unnamed instance of the SessionParameter class. |
![]() | SessionParameter(SessionParameter) | Initializes a new instance of the SessionParameter class with the values of the instance specified by the original parameter. |
![]() | SessionParameter(String, DbType, String) | Initializes a new instance of the SessionParameter class, by using the specified name and type, and binding the parameter to the specified session state name/value pair. This constructor is for database types. |
![]() | SessionParameter(String, String) | Initializes a new named instance of the SessionParameter class, using the specified string to identify which session state name/value pair to bind to. |
![]() | SessionParameter(String, TypeCode, String) | Initializes a new named and strongly typed instance of the SessionParameter class, using the specified string to identify which session state name/value pair to bind to. |
| Name | Description | |
|---|---|---|
![]() | ConvertEmptyStringToNull | Gets or sets a value indicating whether the value that the Parameter object is bound to should be converted to null if it is String.Empty.(Inherited from Parameter.) |
![]() | DbType | Gets or sets the database type of the parameter.(Inherited from Parameter.) |
![]() | DefaultValue | |
![]() | Direction | |
![]() | IsTrackingViewState | |
![]() | Name | Gets or sets the name of the parameter.(Inherited from Parameter.) |
![]() | SessionField | Gets or sets the name of the session variable that the parameter binds to. |
![]() | Size | Gets or sets the size of the parameter.(Inherited from Parameter.) |
![]() | Type | Gets or sets the type of the parameter.(Inherited from Parameter.) |
![]() | ViewState |
| Name | Description | |
|---|---|---|
![]() | Clone() | Returns a duplicate of the current SessionParameter instance.(Overrides Parameter.Clone().) |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Evaluate(HttpContext, Control) | Updates and returns the value of the SessionParameter object.(Overrides Parameter.Evaluate(HttpContext, Control).) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetDatabaseType() | |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | LoadViewState(Object) | Restores the data source view's previously saved view state.(Inherited from Parameter.) |
![]() | MemberwiseClone() | |
![]() | OnParameterChanged() | Calls the OnParametersChanged method of the ParameterCollection collection that contains the Parameter object.(Inherited from Parameter.) |
![]() | SaveViewState() | |
![]() | SetDirty() | |
![]() | ToString() | Converts the value of this instance to its equivalent string representation.(Inherited from Parameter.) |
![]() | TrackViewState() |
| Name | Description | |
|---|---|---|
![]() ![]() | ICloneable.Clone() | |
![]() ![]() | IStateManager.LoadViewState(Object) | This API supports the product infrastructure and is not intended to be used directly from your code. Restores the data source view's previously saved view state.(Inherited from Parameter.) |
![]() ![]() | IStateManager.SaveViewState() | |
![]() ![]() | IStateManager.TrackViewState() | |
![]() ![]() | IStateManager.IsTrackingViewState |
A SessionParameter object is typically used in order to include the value of an HttpSessionState variable in the Where clause of a database query. The SessionField property identifies the session variable from which the SessionParameter retrieves a value.
Note |
|---|
Controls that bind data to a parameter by using a SessionParameter object might throw an exception if the specified session variable is not set. To avoid this error (where appropriate), set the DefaultValue property. |
The following example shows how to use a SessionParameter object. The example assumes that another page has stored an employee ID value in a session variable named empid. The example page uses the empid session variable in the Where clause of a query and displays the result of the query in a GridView control. Because the DefaultValue property of the SessionParameter object is set to 5, data for the record that has the employeeID value of 5 will still be displayed if no session variable named empid is set before you run the example.
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.







