1. 程式人生 > >checkboxlist 如何配置資料來源?

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(); }

比較簡單,已完成