......
<tr>
<td bgcolor="#F4F4F4" style="height: 25px" colspan="4">
<asp:Repeater ID="oneList" runat="server" OnItemDataBound="OneList_ItemDataBound">
<HeaderTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
</HeaderTemplate>
<ItemTemplate>
<td valign="top">
<strong><font color="#FF0000">⊙ <%# DataBinder.Eval(Container.DataItem,"title")%></font></strong>
<asp:Label ID="oneId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"id") %>'
Visible="false"></asp:Label>
<asp:Repeater ID="towList" runat="server">
<HeaderTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td width="4%" height="22">
</td>
<td width="96%" colspan="2">
<asp:CheckBox ID="chkId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"id") %>'>
</asp:CheckBox>
<font color="#000099"><strong>
<%# DataBinder.Eval(Container.DataItem,"title")%>
</strong></font>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table></FooterTemplate>
</asp:Repeater>
</td>
</ItemTemplate>
<FooterTemplate>
</tr> </table>
</FooterTemplate>
</asp:Repeater>
</td>
</tr>
<tr>
<td height="30" colspan="4" align="center" bgcolor="#F4F4F4">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text=" 保 存 " OnClientClick="return ChkKeys();" />
<input id="Reset1" type="reset" value=" 重 填 " />
</td>
</tr>
......
------解决方案--------------------------------------------------------
- C# code
for (int i = 0; i < rptFriend.Items.Count; i++) { if ((rptFriend.Items[i].FindControl("chkId") as CheckBox).Checked) { } }
------解决方案--------------------------------------------------------
foreach (Control ctl in Repeater1.Controls)
{
if (ctl is CheckBox)
{
(ctl as CheckBox).Checked = true;
}
}
------解决方案--------------------------------------------------------
楼上的难道不可以吗
------解决方案--------------------------------------------------------
foreach (Control c in this.Repeater1.Controls)
{
CheckBox check = (CheckBox)c.FindControl("cbDelete1");
if( check != null )
{
check.Checked = true;
}
}
------解决方案--------------------------------------------------------
foreach (Control ctl in Repeater1.Controls)
{
if (ctl is CheckBox)
{
(ctl as CheckBox).Checked = true;
}
}