首页 > 其他 > 详细

Repeater内RadioButton.GroupName失效

时间:2014-07-12 16:25:51      阅读:393      评论:0      收藏:0      [点我收藏+]

最近在做项目时遇到要在repeater中显示多个radiobutton并且实现单选功能,于是很自然地就加上了GroupName,但事实是不行的,在repeater中的radiobutton呈现到页面的时候name会自动加上repeater的id、序列ct100和radiobutton的id,这就直接导致为什么GroupName会失效了。我在网上搜了有很多方法,但是都没适用的,比如用<input type=radio>、radiobuttonlist等,但是我既然用了radiobutton,就懒得换了,以下是我的代码实现:

页面

 1 <table>
 2                             <tr>
 3                                 <asp:Repeater runat="server" ID="repbgs">
 4                                     <ItemTemplate>
 5                                         <td>
 6                                             <asp:RadioButton runat="server"  ID="rdo1" Text=<%# Eval("name") %> />
 7                                         </td>
 8                                     </ItemTemplate>
 9                                 </asp:Repeater>
10                             </tr>
11                         </table>

后台就一个绑定过程就不展示了,还有就是jQuery

1 $(‘:input:radio‘).click(function () {
2                 if ($(this).is(‘:checked‘)) {
3                     $(this).is(‘:checked‘);
4 $(this).parents().siblings().children().removeAttr("checked");
5                 }
6             });

以上就是我的简单实现

Repeater内RadioButton.GroupName失效,布布扣,bubuko.com

Repeater内RadioButton.GroupName失效

原文:http://www.cnblogs.com/tony312ws/p/3838314.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!