Web Forms data binding
ASP.NET Web Forms - Data Binding
We can use data binding (Data Binding) to complete the list with optional options , these options come from an imported data source, such as a database, XML file, or 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 :
<body>
<form runat="server">
<asp:RadioButtonList id="countrylist" runat="server">
<asp:ListItem value="N" text="Norway" />
<asp:ListItem value="S" text="Sweden" />
<asp:ListItem value="F" text="France" />
<asp:ListItem value="I" text="Italy" />
</asp:RadioButtonList> ;
</form>
</body>
</html>
However, we can use some independent data source for data A binding, such as a database, XML file, or script, populates the list of options through data binding.
By using imported data sources, the data is separated from the HTML, and modifications to the optional items are done in the independent data source.
In the next three chapters, we will describe how to bind data from scripted data sources.