asp.net.ph

DataSourceControl Class

System.Web.UI Namespace


.NET Framework version 2.0

Serves as the base class for controls that represent data sources to data-bound controls.

DataSourceControl Class Members

Collapse   Properties

Visibility Name Value Type Accessibility
public ClientID String [ Get ]
public ClientIDMode ClientIDMode [ Get , Set ]
public Controls ControlCollection [ Get ]
public EnableTheming Boolean [ Get , Set ]
public SkinID String [ Get , Set ]
public Visible Boolean [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
public ApplyStyleSheetSkin ( Page page ) Void
protected CreateControlCollection ( ) ControlCollection
public FindControl ( String id ) Control
public Focus ( ) Void
protected GetView ( String viewName ) DataSourceView
protected GetViewNames ( ) ICollection
public HasControls ( ) Boolean
protected RaiseDataSourceChangedEvent ( EventArgs e ) Void
public RenderControl ( HtmlTextWriter writer ) Void

Remarks

ASP.NET supports a control data-binding architecture that enables Web server controls to bind to data in a consistent fashion. Web server controls that bind to data are referred to as data-bound controls, and the classes that facilitate that binding are called data source controls. Data source controls can represent any data source: a relational database, a file, a stream, a business object, and so on. Data source controls present data in a consistent way to data-bound controls, regardless of the source or format of the underlying data.

You use the data source controls that are provided with ASP.NET, including SqlDataSource, AccessDataSource, and XmlDataSource, to perform most Web development tasks. You use the base DataSourceControl class when you want to implement your own custom data source control.

While any class that implements the IDataSource interface is a data source control, most ASP.NET data source controls extend the abstract DataSourceControl class, which provides a base implementation of the IDataSource interface. The DataSourceControl class also provides an implementation of the IListSource interface, which enables you to programmatically assign the data source control to the DataSource property of a data-bound control and return data to the control as a basic list.

Any ASP.NET control that derives from the DataBoundControl class can bind to a data source control. When a DataBoundControl is bound to a data source control, data binding is performed automatically at run time. You can also use data source controls with ASP.NET controls that expose a DataSource or DataSourceID property and support basic data binding, but are not derived from DataBoundControl. When using these data-bound controls, you must explicitly call the DataBind method.

You can think of a data source control as the combination of the DataSourceControl object and its associated lists of data, called data source views. Each list of data is represented by a DataSourceView object. Because the underlying data storage contains one or more lists of data, a DataSourceControl is always associated with one or more named DataSourceView objects. The IDataSource interface defines the methods that all data source controls use to interact with data source views: the GetViewNames method is used to enumerate the data source views currently associated with the data source control, and the GetView method is used to retrieve a specific data source view instance by name.

You can also think of the data source control as two distinct interfaces that callers use to access data. The DataSourceControl class is the interface that page developers interact with directly when developing a Web Forms page, and the DataSourceView class is the interface that data-bound controls and data-bound control authors interact with. Because the DataSourceView object is available only at run time, any state persisted for the data source control or data source view must be exposed directly by the data source control.

There is no visual rendering of ASP.NET data source controls; they are implemented as controls so you can create them declaratively, and to optionally allow them to participate in state management. As a result, data source controls do not support visual features.

See Also

DataBoundControl Class   DataSourceView Class   IDataSource Interface 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