ASP.NET Web Forms - Data Binding
We can use data binding to populate lists with options that come from an imported data source, such as a database, an XML file, or a script.
Data Binding
The following controls are list controls that support data binding:
- asp:RadioButtonList
- asp:CheckBoxList
- asp:DropDownList
- asp:Listbox
The options for each of the above controls are usually defined in one or more asp:ListItem controls, as follows:
However, we can use some independent data source, such as a database, an XML file, or a script, to perform data binding and populate the options of the list.
By using an imported data source, the data is separated from the HTML, and modifications to the options are made in the independent data source.
In the following three sections, we will describe how to bind data from a scripted data source.