FineUI 官方论坛
标题:
【求助】checkboxlist动态绑定数据后,SelectedValueArray 无法更新
[打印本页]
作者:
sam.chang
时间:
2014-9-4 21:28
标题:
【求助】checkboxlist动态绑定数据后,SelectedValueArray 无法更新
本帖最后由 sam.chang 于 2014-9-4 21:50 编辑
aspx页面
<f:CheckBoxList ID="cblschoollevel" runat="server" Label="学校类别限制" ColumnNumber="3" Required="True">
</f:CheckBoxList>
c# List<SchoolLevel> levels = db.SchoolLevelSet.ToList();
this.cblschoollevel.DataTextField = "LevelName";
this.cblschoollevel.DataValueField = "SchoolLevelID";
this.cblschoollevel.DataSource = levels;
this.cblschoollevel.DataBind();
this.cblschoollevel.SelectedValueArray = new string[] { "2","3" }; //ArrayHelper.StringToArray(ce.SchoolLevels);
SelectedValueArray 无法更新,2,3两个ID都是存在的,4.06版
作者:
sam.chang
时间:
2014-9-4 21:57
改成这种方式,就可以了,好奇怪啊。
foreach (SchoolLevel sl in levels)
{
this.cblschoollevel.Items.Add(new CheckItem(sl.LevelName,sl.SchoolLevelID.ToString()));
}
this.cblschoollevel.SelectedValueArray = ArrayHelper.StringToArray(ce.SchoolLevels);
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4