There are a few simple techniques you will need to employ to make data binding work. The basic items we will need are a source of data, some data items to bind, and a control that allows data binding.
Essentially, a Data Source is an instance or a collection of instances that we will use to populate our control(s). For instance, if we had a group of products, we could create an IList of classes containing image and product name, size, weight, price, and so on.
There are two common ways to set the DataSource
property of a control. The first is to directly bind it from the code behind or within another object. The second is to use a DataSourceId
to specify the ID of a control on the page such as an ObjectDataSource
control from which the data is coming.
The individual data items that make up the Data Source can be just about anything, from a simple string to a full-blown POCO with properties of child POCOs.