• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Grid Controls > The DataGrid Control

The DataGrid Control

The DataGrid is at once simpler and more complex than the ListView control. It is similar to the Details mode of the ListView control in that it displays a grid of rows and columns, and you can control the columns that are displayed by controlling the objects that represent them. It is simpler in that the control is data-bound, and so you needn't manually add the rows. It is more complex in that the control can display rows from multiple DataTable objects if you have established DataRelations among them, and you have much finer control over the display of individual columns and items.

Figure 14-8 shows the default display of the DataGrid when bound to a DataTable with child records. Like most data-bound controls, you bind the DataGrid by setting its DataSource and DataMember properties. Typically, you set the DataSource to the name of the DataSet, and the DataMember to the top-level table. You can do this at design time using the Properties window, or at runtime using the SetDataBinding method of the DataGrid.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint