15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1162 ❘ ChaPTer 40 cOre Asp.net<br />

(continued)<br />

ConTrol<br />

Substitution<br />

Localize<br />

desCriPTion<br />

Specifies a section of a web page that isn’t cached along with other output. This is an<br />

advanced topic related to ASP.<strong>NET</strong> caching behavior, which you won’t be looking at in<br />

this book.<br />

Exactly like Literal, but enables text to be localized by using project resources to<br />

specify the text to display for various locales.<br />

Data Web Server Controls<br />

The data web server controls are divided into three types:<br />

➤ Data source controls (SqlDataSource, AccessDataSource, LinqDataSource, EntityDataSource,<br />

ObjectDataSource, XmlDataSource, <strong>and</strong> SiteMapDataSource)<br />

➤ Data display controls (GridView, DataList, DetailsView, FormView, ListView, Repeater, <strong>and</strong><br />

DataPager)<br />

➤ Dynamic data controls (DynamicControl <strong>and</strong> DynamicDataManager)<br />

In general, you will place one of the (nonvisual) data source controls on a page to link to a data source; <strong>and</strong><br />

then you will add a data display control that binds to a data source control to display that data. Some of the<br />

more advanced data display controls, such as GridView, also allow you to edit data.<br />

All the data source controls derive from either System.Web.UI.DataSource or System.Web.UI.Hierarc<br />

hicalDataSource. These classes expose methods such as GetView() or GetHierarchicalView() to give<br />

access to internal data views <strong>and</strong> skinning capabilities.<br />

The following table describes the various data source controls. Note that there is less detail about properties<br />

in this section than in others — mainly because configuration of these controls is best done graphically or<br />

through wizards. Later in this chapter, you will see some of these controls in action.<br />

ConTrol<br />

SqlDataSource<br />

AccessDataSource<br />

LinqDataSource<br />

EntityDataSource<br />

ObjectDataSource<br />

XmlDataSource<br />

SiteMapDataSource<br />

desCriPTion<br />

Acts as a conduit for data stored in a SQL Server database. By placing this<br />

control on a page, you can manipulate SQL Server data using a data display<br />

control. You will see this control in action later in this chapter.<br />

Like SqlDataSource, but it works with data stored in a Microsoft Access<br />

database.<br />

This control allows you to manipulate objects in a LINQ-enabled data model.<br />

This control allows you to manipulate ADO.<strong>NET</strong> Entity Data Model objects.<br />

This control allows you to manipulate data stored in objects that you have<br />

created, which may be grouped in a collection class. This can be a very quick<br />

way to expose custom object models to an ASP.<strong>NET</strong> page.<br />

Enables you to bind to XML data. This works well in binding to, for example, a<br />

TreeView control (one of the Navigation controls). You can also transform XML<br />

data using an XSL style sheet using this control if desired.<br />

Allows binding to hierarchical site map data. See the section on navigation web<br />

server controls in Chapter 41 for more information.<br />

The following table displays the data display controls. Several of these are available to suit various needs.<br />

Some are more fully functional than others, but often you can go with simplicity (for example, when you<br />

don’t need to be able to edit data items).<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!