Conclusion

 

ASP.NET data binding has three faces classic source-based binding as in ASP.NET 1.x, data source controls, and data-binding expressions. Data-binding expressions serve a different purpose from the other two binding techniques. Expressions are used declaratively and within templated controls. They represent calculated values bindable to any property. In ASP.NET 2.0, support for expressions has been empowered to go beyond the boundaries of classic data binding. ASP.NET 2.0 supports custom expressions that are evaluated when the page loads, not when the data-binding process is triggered.

The data-binding model of ASP.NET 1.x is maintained intact with enumerable collections of data bound to controls through the DataSource property and a few related others. In addition, a new family of controls makes its debut data source controls. By virtue of being implemented as a control, a data source component can be declaratively persisted into a Web page without any further effort in code. In addition, data source controls can benefit from other parts of the page infrastructure, such as the view state and ASP.NET cache. Data source controls accept parameters, prepare and execute a command, and return results (if any). Commands include the typical data operations select, insert, update, delete, and total count.

The most interesting consequence of data source controls is the tight integration with some new data-bound controls. These smarter data-bound controls (GridView, DetailsView) contain logic to automatically bind at appropriate times on behalf of the page developer, and they interact with the underlying data source intelligently, requiring you to write much less code. Existing data-bound controls have been extended to support data source controls, but only for select operations.

Data source controls make declarative, codeless programming easier and likely to happen in reality. Data source controls, though, are just tools and not necessarily the right tool for the job you need to do.

In the next chapter, we continue our examination of data binding from another perspective data-bound controls.

 


Programming Microsoft ASP. Net 2.0 Core Reference
Programming Microsoft ASP.NET 2.0 Core Reference
ISBN: 0735621764
EAN: 2147483647
Year: 2004
Pages: 112
Authors: Dino Esposito

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