Professional C# 2005
by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones
Chapter 24. Viewing .NET Data
This chapter builds on the content of Chapter 19, "Data Access with .NET," which covers various ways of selecting and changing data, showing you how to present data to the user by binding to various Windows controls. More specifically, this chapter discusses:
Displaying data using the
DataGridViewcontrol—new with Visual Studio 2005The .NET data-binding capabilities and how they work
How to use the Server Explorer to create a connection and generate a
DataSetclass (all without writing a line of code)How to use hit testing and reflection on rows in the
DataGrid
You can download the source code for the examples in this chapter from the Wrox Web site at www.wrox.com.
The DataGridView Control
The DataGrid control that has been available from the initial release of .NET was functional, but had many areas that made it unsuitable for use in a commercial application—such as an inability to display images, drop-down controls, or lock columns, to name but a few. The control always felt half completed, so many control vendors provided custom grid controls that overcame these deficiencies and also provided much more functionality.
With .NET 2.0, you now have an additional Grid control—the DataGridView. This addresses many of the deficiencies of the original control, and adds significant functionality that has to this point only been available with add-on products.
The new control has similar binding capabilities as the old DataGrid, so it can bind to an Array, DataTable, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access