repeater 怎样把数据库的值绑定在checkboxlist上
急,DataTabledt=AdminUserManager.GetDataTableAllAdminUser();string[]strtemp=dt.Rows[0][...
急, DataTable dt = AdminUserManager.GetDataTableAllAdminUser();
string[] strtemp = dt.Rows[0]["AdminLimitId"].ToString().Split();
foreach (string str in strtemp)
{
CheckBoxList cb2 = (CheckBoxList)e.Item.FindControl("CheckBoxList1");
for (int i = 0; i < cb2.Items.Count; i++)
{
CheckBoxList cc = (CheckBoxList)e.Item.FindControl("CheckBoxList1");
if (this.cc.Items[i].Value == str)
{
CheckBoxList cb4 = (CheckBoxList)e.Item.FindControl("CheckBoxList1");
this.cb4.Items[i].Selected = true;
}
}
} 展开
string[] strtemp = dt.Rows[0]["AdminLimitId"].ToString().Split();
foreach (string str in strtemp)
{
CheckBoxList cb2 = (CheckBoxList)e.Item.FindControl("CheckBoxList1");
for (int i = 0; i < cb2.Items.Count; i++)
{
CheckBoxList cc = (CheckBoxList)e.Item.FindControl("CheckBoxList1");
if (this.cc.Items[i].Value == str)
{
CheckBoxList cb4 = (CheckBoxList)e.Item.FindControl("CheckBoxList1");
this.cb4.Items[i].Selected = true;
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询