checkboxlist 如何配置数据源?
<f:CheckBoxList runat="server" ColumnNumber="4" ColumnVertical="true" ID="checkboxlist1" Label="项目名称" ></f:CheckBoxList>
后台代码如下:
DataSet myData= mySystem.GetProjectList(Convert.ToInt32(LoginUserDepID), LoginUserDepName); if (myData.Table[0].rows.Count>0) { chbProjectName.Items.Clear(); chbProjectName.DataSource = myData.Tables[0]; chbProjectName.DataTextField = "projectname"; chbProjectName.DataValueField = "f_id"; chbProjectName.DataBind(); }
比较简单,已完成