关于CheckBoxList的取值问题
我的CheckBoxList是在repeater的ItemDataBound事件里面动态生成的,现在在按钮的添加事件下面应该如何获取CheckBoxList选中的值呢?求助!
[解决办法]
贴点源码上来看看吧,应该用FindControl方法可以找到的
[解决办法]
遍历repeater
FindControl().
Checkboxlist chkblist=(Checkboxlist)Repeater.Item.FindControl("");
foreach (ListItem items in CheckBoxList1.Items
{
items.Selected = true;
//...
}
[解决办法]
以前写的一个 。你看下有用么
for (int i = 0; i < Repeater1.Items.Count; i++)
{
Repeater repeater2 = Repeater1.Items[i].FindControl("Repeater2") as Repeater;
if (repeater2 != null)
{
for (int j = 0; j < repeater2.Items.Count; j++)
{
CheckBox cb = repeater2.Items[j].FindControl("chkbox2") as CheckBox;
cb.Checked = false;
Label lbnum = repeater2.Items[j].FindControl("Label1") as Label;
for (int h = 0; h < ssid.Length - 1; h++)
{
if (lbnum.Text == ssid[h].ToString())
{
cb.Checked = true;
}
}
}
}
}
[解决办法]
我这个是两个repeater。。。
[解决办法]
根据这个思路完全可以解决你的问题了。