您的位置:首页 > 其它

如何获取Repeater中checkbox的值

2012-11-13 12:06 239 查看
前台:

<asp:Repeater ID="rptInfo" runat="server">
<ItemTemplate>
<input type="checkbox" runat="server" id="PathId" name="PathId" value = "数据绑定"/>
</ItemTemplate>
<AlternatingItemTemplate>
<input type="checkbox" runat="server" id="PathId" name="PathId" value = "数据绑定"/>
</AlternatingItemTemplate>
</asp:Repeater>

后台:

一般是在Repeater之外的一个Button的Click中用遍历的方法实现
CheckBox cb;
foreach(RepeaterItem ri in rptinfo.Items)
{
cb=ri.FindControl("PathId") as CheckBox;
if(cb.Checked)//这个是被选择的项
{
//在这里做选择了要做的操作。。。。
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: