页面
<form id="form1" runat="server">
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
oninit="CheckBoxList1_Init">
</asp:CheckBoxList>
</form>
CS文件
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CheckBoxList1_Init(object sender, EventArgs e)
{
string[] Genre = { "a1", "a2", "a3", "a4" };
CheckBoxList1.DataSource = Genre;
CheckBoxList1.DataBind();
}
}