C# 获取Repeater里的复选框选择后无效
<asp:RepeaterID="RpList"runat="server"><ItemTemplate><tr><tdwidth="38"height="150"ali...
<asp:Repeater ID="RpList" runat="server">
<ItemTemplate>
<tr>
<td width="38" height="150" align="center" valign="middle">
<asp:CheckBox ID="sle" runat="server"></asp:CheckBox>
</td>
<td width="100" height="150" align="center" valign="middle">
<img src='<%#Eval("img")%>' width="100" height="135" />
</td>
<td width="66" height="150" align="center" valign="middle">
<%#Eval("srcName")%>
</td>
<td width="74" height="150" align="center" valign="middle">
<%#Eval("title")%>
</td>
<td width="170" height="150" align="center" valign="middle">
<%#Eval("graduateSchool")%>
</td>
<td width="411" height="150" align="center" valign="middle">
<%#Eval("successCase")%>
</td>
<td width="70" height="150" align="center" valign="middle">
<a href="#">修改</a> <a href="#">删除</a>
</td>
<td width="0" height="150" align="center" valign="middle">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("ID")%>' Width="0"></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
for (int i = 0; i < RpList.Items.Count; i++)
{
CheckBox chk = (CheckBox)RpList.Items[i].FindControl("sle");
if (chk != null && chk.Checked == true)
{
Label CKID = (Label)RpList.Items[i].FindControl("Label1");
if (strOpid == "")
strOpid += ("(" + CKID.Text);
else
strOpid += ("," + CKID.Text);
}
}
这里选择后 后台 CheckBox chk 全是false 这是为什么 展开
<ItemTemplate>
<tr>
<td width="38" height="150" align="center" valign="middle">
<asp:CheckBox ID="sle" runat="server"></asp:CheckBox>
</td>
<td width="100" height="150" align="center" valign="middle">
<img src='<%#Eval("img")%>' width="100" height="135" />
</td>
<td width="66" height="150" align="center" valign="middle">
<%#Eval("srcName")%>
</td>
<td width="74" height="150" align="center" valign="middle">
<%#Eval("title")%>
</td>
<td width="170" height="150" align="center" valign="middle">
<%#Eval("graduateSchool")%>
</td>
<td width="411" height="150" align="center" valign="middle">
<%#Eval("successCase")%>
</td>
<td width="70" height="150" align="center" valign="middle">
<a href="#">修改</a> <a href="#">删除</a>
</td>
<td width="0" height="150" align="center" valign="middle">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("ID")%>' Width="0"></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
for (int i = 0; i < RpList.Items.Count; i++)
{
CheckBox chk = (CheckBox)RpList.Items[i].FindControl("sle");
if (chk != null && chk.Checked == true)
{
Label CKID = (Label)RpList.Items[i].FindControl("Label1");
if (strOpid == "")
strOpid += ("(" + CKID.Text);
else
strOpid += ("," + CKID.Text);
}
}
这里选择后 后台 CheckBox chk 全是false 这是为什么 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询