ASP.NET Syntax ASP.NET Syntax for Web Controls
Enables declarative data-binding to data exposed by a custom business object for use in multi-tier Web application architectures.
Declarative Syntax
<asp:ObjectDataSource
CacheDuration = "string | Infinite"
CacheExpirationPolicy = "Absolute | Sliding"
CacheKeyDependency = "string"
ConflictDetection = "OverwriteChanges | CompareAllValues"
ConvertNullToDBNull = "True | False"
DataObjectTypeName = "string"
DeleteMethod = "string"
EnableCaching = "True | False"
EnablePaging = "True | False"
EnableTheming = "True | False"
EnableViewState = "True | False"
FilterExpression = "string"
ID = "string"
InsertMethod = "string"
MaximumRowsParameterName = "string"
OldValuesParameterFormatString = "string"
OnDataBinding = "DataBinding event handler"
OnDeleted = "Deleted event handler"
OnDeleting = "Deleting event handler"
OnDisposed = "Disposed event handler"
OnFiltering = "Filtering event handler"
OnInit = "Init event handler"
OnInserted = "Inserted event handler"
OnInserting = "Inserting event handler"
OnLoad = "Load event handler"
OnObjectCreated = "ObjectCreated event handler"
OnObjectCreating = "ObjectCreating event handler"
OnObjectDisposing = "ObjectDisposing event handler"
OnPreRender = "PreRender event handler"
OnSelected = "Selected event handler"
OnSelecting = "Selecting event handler"
OnUnload = "Unload event handler"
OnUpdated = "Updated event handler"
OnUpdating = "Updating event handler"
runat = "server"
SelectCountMethod = "string"
SelectMethod = "string"
SkinID = "string"
SortParameterName = "string"
SqlCacheDependency = "string"
StartRowIndexParameterName = "string"
TypeName = "string"
UpdateMethod = "string"
Visible = "True | False"
>
<DeleteParameters>
<asp:ControlParameter
ControlID = "string"
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:CookieParameter
ConvertEmptyStringToNull = "True | False"
CookieName = "string"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:FormParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
FormField = "string"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:Parameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:ProfileParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:QueryStringParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
QueryStringField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:SessionParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
SessionField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
</DeleteParameters>
<FilterParameters>
<asp:ControlParameter
ControlID = "string"
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:CookieParameter
ConvertEmptyStringToNull = "True | False"
CookieName = "string"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:FormParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
FormField = "string"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:Parameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:ProfileParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:QueryStringParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
QueryStringField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:SessionParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
SessionField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
</FilterParameters>
<InsertParameters>
<asp:ControlParameter
ControlID = "string"
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:CookieParameter
ConvertEmptyStringToNull = "True | False"
CookieName = "string"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:FormParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
FormField = "string"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:Parameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:ProfileParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:QueryStringParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
QueryStringField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:SessionParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
SessionField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
</InsertParameters>
<SelectParameters>
<asp:ControlParameter
ControlID = "string"
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:CookieParameter
ConvertEmptyStringToNull = "True | False"
CookieName = "string"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:FormParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
FormField = "string"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:Parameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:ProfileParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:QueryStringParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
QueryStringField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:SessionParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
SessionField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
</SelectParameters>
<UpdateParameters>
<asp:ControlParameter
ControlID = "string"
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:CookieParameter
ConvertEmptyStringToNull = "True | False"
CookieName = "string"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:FormParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
FormField = "string"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:Parameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:ProfileParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
PropertyName = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:QueryStringParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
QueryStringField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
<asp:SessionParameter
ConvertEmptyStringToNull = "True | False"
DefaultValue = "string"
Direction = "Input | Output | InputOutput | ReturnValue"
Name = "string"
SessionField = "string"
Size = integer
Type = "Empty | Object | DBNull | Boolean | Char | SByte |
Byte | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 |
Single | Double | Decimal | DateTime | String"
/>
</UpdateParameters>
</asp:ObjectDataSource>
For information on the individual members of this class, see ObjectDataSource in the class library.
The ObjectDataSource control is an ASP.NET data source control that represents a data-aware middle-tier object or a data-interface object to data-bound controls. You can use the ObjectDataSource control in conjunction with a data-bound control to display, edit, and sort data on a Web page with little or no code.
The following example demonstrates how to use a GridView control to display data using an ObjectDataSource control on a Web Forms page. The ObjectDataSource identifies the partially or fully qualified class name of a business object with its TypeName property and a business object method that is called to retrieve data with its SelectMethod property. At run time, the object is created and the method is called using reflection. The GridView control enumerates through the IEnumerable collection that is returned by the SelectMethod and displays the data.
For an example of a middle-tier business object that could be used with this example, see the class overview for ObjectDataSource.
<asp:gridview
id="GridView1"
runat="server"
datasourceid="ObjectDataSource1" />
<asp:objectdatasource
id="ObjectDataSource1"
runat="server"
selectmethod = "GetAllEmployees"
typename = "Samples.AspNet.CS.EmployeeLogic" />
ObjectDataSource Class ObjectDataSource Web Server Control