asp.net.ph

SqlDataSource.DataSourceMode Property

System.Web.UI.WebControls Namespace   SqlDataSource Class


.NET Framework version 2.0

Sets or retrieves the data retrieval mode that the SqlDataSource control uses to fetch data.

Syntax


Inline <asp:SqlDataSource datasourcemode = enumValue ... >
Script SqlDataSource.DataSourceMode [ = enumValue ]

Property Value


enumValue One of the SqlDataSourceMode values.

The property is read/write with a default value of DataSet.

Exceptions


Exception Type Condition
ArgumentOutOfRangeException The DataSourceMode property is not one of the values defined in the SqlDataSourceMode.

Remarks

The data retrieval mode identifies how a SqlDataSource control retrieves data from the underlying database.

When the DataSourceMode property is set to the DataSet value, data is loaded into a DataSet object and stored in memory on the server. This enables scenarios where user interface controls, such as GridView, offer sorting, filtering, and paging capabilities.

When the DataSourceMode property is set to the DataReader value, data is retrieved by a IDataReader object, which is a forward-only, read-only cursor. The specific type of the IDataReader object depends on the NET data provider that the SqlDataSource uses, which is identified by the ProviderName property. By default, the SqlDataSource control uses the provider for Microsoft SQL Server, the System.Data.SqlClient, and the data reader is a SqlDataReader object.

If you change the DataSourceMode property, the DataSourceChanged event is raised, causing any controls that are bound to the SqlDataSource to rebind.

The value of the DataSourceMode property is stored in view state.

Example

The following examples demonstrate how to set the DataSourceMode property.

Master~Details Using GridViews Bound to SqlDataSource Controls
Run Sample | View Source
GridView ImageField Example
Run Sample | View Source
GridView PagerSettings, PagerStyle Example
Run Sample | View Source
Skip Navigation Links



Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph