C#:动态生成的CheckBoxList怎么获取值?
生成CheckBoxList的函数:
int i;
for (i = 0; i < 5; i++)
{
CheckBoxList cblist = new CheckBoxList();
for (int j = 1; j < 5; j++)
{
ListItem item = new ListItem();
item.Text =……
cblist.Items.Add(item);
}
网页上的HTML代码:(只列出了一个)
<span>……</span><table id="ctl24">
<tr>
<td><input id="ctl24_0" type="checkbox" name="ctl24$0" value="……" /><label for="ctl24_0">……</label></td>
</tr><tr>
<td><input id="ctl24_1" type="checkbox" name="ctl24$1" value="……" /><label for="ctl24_1">……</label></td>
</tr><tr>
<td><input id="ctl24_2" type="checkbox" name="ctl24$2" value="……" /><label for="ctl24_2">……</label></td>
</tr><tr>
<td><input id="ctl24_3" type="checkbox" name="ctl24$3" " value="……"/><label for="ctl24_3">…</label></td>
</tr>
问题:
动态生成的CheckBoxList的名字不是 ct124 吗?为什么this.FindControl("ctl24")的值是个空值?该怎么解决?