Summary


In this chapter, we've looked in some detail at a specific new feature that is available when using ASP.NET, namely server-side data binding . This allows you to insert values from a range of different types of data source into a page, or into controls on a page. Together with the eight special list controls that are part of the .NET Framework, this allows you to build data-driven pages with a minimum of code and effort.

There are two basic types of data binding supported in ASP.NET “ single-value binding to any control, and repeated-value binding to the special list controls. Single-value binding can be used with a property, method result, or an expression to create a value that is then used to set a property or the content of any other control “ effectively just inserting this value. A simple example would be setting the Text property of a Label control to the same value as currently selected in a listbox.

Repeated-value data binding takes a data source such as an ArrayList , a HashTable , a Collection , a DataView , a DataReader , or a DataSet object. Using any of the eight special list controls, it will then display the contents of the data source as a series of repeated rows or items. Depending on the type of control, you can add formatting and specify the actual content in a range of ways. For example, you can specify the number of columns and the layout direction for a Repeater control, or could hide columns, add custom columns, sort and filter rows, and use automatic paging in a DataGrid control.

As well as looking at how to use these list controls to display data, we also ( briefly ) introduced the features they provide for updating data. This gives you an easy way to build an intuitive interface for managing all kinds of data “ in particular, data extracted from and updated to a relational database.

We've talked quite a lot about working with relational data through objects like the DataReader and DataView in this chapter, without really explaining much about them. However, this is because we wanted to cover the wide range of server controls that are part of ASP.NET first so that you would be comfortable with creating dynamic pages. We make up for this omission by now starting a detailed exploration of the various ways of working with data in ASP.NET over the next four chapters.




Professional ASP. NET 1.1
Professional ASP.NET MVC 1.0 (Wrox Programmer to Programmer)
ISBN: 0470384611
EAN: 2147483647
Year: 2006
Pages: 243

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