Chapter 16. Data-Bound Controls


Data binding is the process of associating user interface (UI) elements with a data source to generate a visual representation of data. ASP.NET provides declarative data-binding syntax ( <%# %> ) that allows a page developer to easily bind data to any read/write property of a server control. When the data source represents a collection of items or records, it is not possible to bind the entire collection to a single property of a control. This scenario requires specialized controls that can enumerate the objects in the collection to generate a visual representation for each enumerated object. Controls that are bound to a collection-based data source are known as data-bound controls . In addition to merely displaying data, data-bound controls can offer additional capabilities, such as sorting and editing.

ASP.NET provides a set of versatile data-bound controls ( Repeater , Data ­List , and DataGrid ) that cover many common data-binding scenarios. However, when the built-in controls are not adequate, you might need custom data-bound controls. In this chapter, we'll examine the data-binding architecture of the ASP.NET page framework and show you how to implement a custom data-bound server control. In addition, we'll demonstrate how to implement a data-bound control designer, which can greatly enhance the design-time experience offered by a data-bound control.

In this chapter, we will not describe templated data-bound controls, which expose ITemplate properties to enable page developers to customize some or all of the control's UI. We'll demonstrate those controls in Chapter 20, "Data-Bound Templated Controls," by combining the implementation of templates (described in Chapter 12, "Composite Controls") with data binding. The Repeater and DataList controls are examples of templated data-bound controls.



Developing Microsoft ASP. NET Server Controls and Components
Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)
ISBN: 0735615829
EAN: 2147483647
Year: 2005
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net