asp.net multiple Binding example: using this.DataBind()
MultipleBindingExample.aspx
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, System.EventArgs e) {
if (!this.IsPostBack) {
List<string> DataToolBoxControls = new List<string>();
DataToolBoxControls.Add("GridView");
DataToolBoxControls.Add("DetailsView");
DataToolBoxControls.Add("FormView");
ListBox1.DataSource = DataToolBoxControls;
DropDownList1.DataSource = DataToolBoxControls;
RadioButton1List1.DataSource = DataToolBoxControls;
CheckBoxList1.DataSource = DataToolBoxControls;
this.DataBind();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>asp.net multiple Binding example: using this.DataBind()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy">Example: using this.DataBind()</h2>
<asp:ListBox
ID="ListBox1"
runat="server"
BackColor="HotPink"
ForeColor="AliceBlue"
>
</asp:ListBox>
<br /><br />
<asp:DropDownList
ID="DropDownList1"
runat="server"
BackColor="CornflowerBlue"
ForeColor="AliceBlue"
>
</asp:DropDownList>
<br /><br />
<asp:RadioButtonList
ID="RadioButton1List1"
runat="server"
BackColor="AliceBlue"
ForeColor="SeaGreen"
BorderWidth="2"
BorderColor="Green"
>
</asp:RadioButtonList>
<br /><br />
<asp:CheckBoxList
ID="CheckBoxList1"
runat="server"
BackColor="AntiqueWhite"
ForeColor="IndianRed"
BorderWidth="2"
BorderColor="IndianRed"
>
</asp:CheckBoxList>
</div>
</form>
</body>
</html>
