Radiobutton. groupname in repeater is invalid.

Source: Internet
Author: User

Recently, when I was working on a project, I had to display multiple radiobutton In the repeater and implement the Single-choice function. As a result, groupname is added naturally, but this is not the case, when radiobutton in repeater is displayed to the page, the name will automatically add the repeater ID, sequence ct100, and radiobutton ID, which directly leads to the failure of groupname. I have searched for many methods on the Internet, but they are not applicable, such as using <input type = radio> and radiobuttonlist. However, since radiobutton is used, I am too reluctant to change it, the following is my code implementation:

Page

 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>

The backend will not be displayed in a binding process, and jquery

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

The above is my simple implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.