Binding Data to Multi-Value Web Controls

Binding data to a DataGrid, DataList, or Repeater control is easiest of all. All you have to do is have an object that implements IEnumerable, assign this object to the DataSource property of the prospective control, and invoke DataBind on that control. The ease with which you can get data into these controls in no way mitigates their utility. You can perform mundane tasks, like simply binding a DataView object, or create elaborate, complex interfaces with a bit of clever invention. (Read the Using a DataList Control to Repeat Composite Controls section later in this chapter for more information.)

Refer to Listing 16.4 for a quick example of getting a DataView object into a DataGrid control. Listing 16.7 ...

Get Visual Basic® .NET Power Coding now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.