How to populate (DataBind) CheckBoxList using string array DataSource in asp.net
StringArrayCheckBoxList.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
string[] controlArray = { "Localize", "Label", "Panel", "ListBox", "RadioButton" };
Label1.Text = "String array created and bind with CheckBoxList successfully!";
CheckBoxList1.DataSource = controlArray;
CheckBoxList1.DataBind();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to populate (DataBind) CheckBoxList using string array DataSource in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Green">asp.net array example: String Array and CheckBoxList</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Size="Large"
ForeColor="SaddleBrown"
Font-Bold="true"
Font-Italic="true"
>
</asp:Label>
<br /><br />
<asp:CheckBoxList
ID="CheckBoxList1"
runat="server"
BackColor="SteelBlue"
ForeColor="FloralWhite"
>
</asp:CheckBoxList>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
OnClick="Button1_Click"
Font-Bold="true"
Text="Populate CheckBoxList With String Array"
ForeColor="SaddleBrown"
/>
</div>
</form>
</body>
</html>
- How to populate ListBox from two dimension string array in asp.net
- How to create text file and write text programmatically in asp.net
- How to populate DropDownList from two dimension string array in asp.net
- How to populate RadioButtonList from two dimension string array in asp.net
- How to populate BulletedList from two dimension string array in asp.net
- How to populate CheckBoxList from two dimension string array in asp.net
- How to get two dimension string array specific index position value in asp.net
- How to get two dimension int array specific index position value in asp.net
- How to get int array specific index position value in asp.net
- How to get string array specific index position value in asp.net