Browse DevX
Sign up for e-mail newsletters from DevX


Learn to Use the New Data Source Controls in ASP.NET 2.0

You can declaratively connect your data sources to Web form controls with ease in ASP.NET 2.0. In this article, three new data source controls are described in detail: ObjectDataSource, DataSetDataSource, and XmlDataSource.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

here's no shortage of useful, new controls to investigate in ASP.NET 2.0. In my last article, I discussed the new GridView and DetailsView controls. In that article I also discussed the use of the SqlDataSource control, which allows you to declaratively connect to a SQL data source without any coding.

Besides the SqlDataSource control, ASP.NET 2.0 comes with several other new data source controls:

  • AccessDataSource—connects to an Access database
  • ObjectDataSource—connects to a business object and treats it as a data source
  • DataSetDataSource—manipulates an XML document as a dataset
  • XmlDataSource—loads an XML document for binding to controls such as the DataList and TreeView controls
  • SiteMapDataSource—loads a site map file and exposes it to controls such as the TreeView and SiteMapPath controls
Figure 1 shows these new data source controls under the Data tab in the Toolbox.

Figure 1. In Control: The various data source controls are stored under the Data tab in the Toolbox.
In this article, I will concentrate on the ObjectDataSource control, DataSetDataSource control, and the XmlDataSource control. The SqlDataSource control is discussed in the previous article and the AccessDataSource control is similar to it, except that it connects to an Access database. That leaves the SiteMapDataSource control for discussion in a future article where I'll use it to build navigation objects.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date