如何获取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)//这个是被选择的项
{
//在这里做选择了要做的操作。。。。
}
}
<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)//这个是被选择的项
{
//在这里做选择了要做的操作。。。。
}
}
相关文章推荐
- .NET关于Repeater如何遍历里面的CheckBox,并且怎么获取每一列的值!(三张表的)
- Javascript如何获取CheckBoxList控件列表项的值?
- JQuery实现下拉框的选择 与当CheckBox为服务器控件时如何获取值的操作,实现全选与删除
- 如何获取页面中所有的checkbox
- 获取不到Repeater控件中的CheckBox选中状态
- 如何用js获取checkbox的value值
- 如何获取datagridview中checkbox选中的多行数据
- 如何用js在repeater中获取服务器控件的id
- 如何在jsp页面中获取select,radio,checkbox的值
- PHP中如何获取多个checkbox的值
- 使用masterpage的情况下如何使用js实现repeater控件里的checkbox全选
- Javascript如何获取CheckBoxList的value
- 如何获取repeater某行第一列的值
- 关于Repeater如何获取控件对象
- 如何获取listview里选中的checkbox
- jquery如何获取checkbox选中值
- 如何获取CheckBoxList中的value值
- 在vc中如何获取checkbox的值(转)
- djang如何获取checkbox的值
- 再Repeater模板中,如何获取里面的控件 客户端ID ??