//获取checkboxlist的值 public string getCBL(CheckBoxList cbl) { string temp = ""; for (int i = 0; i < cbl.Items.Count; i++) { if (cbl.Items[i].Selected) { temp += cbl.Items[i].Value + ","; } } return temp; } //设置checkboxlist的值 protected void setCBL(CheckBoxList cbl,string value) { string[] temp = value.Split(','); for (int i = 0; i < cbl.Items.Count; i++) { if (temp.Contains(cbl.Items[i].Value)) { cbl.Items[i].Selected = true; } } }
横向显示
<asp:CheckBoxList ID="cbl_MortgageType" runat="server" RepeatDirection="Horizontal"> </asp:CheckBoxList>