0

I have the code below, the group name didn't work, the user can choose any more than one from radio button

<asp:ListView ID="lstActive" runat="server" OnItemDataBound="lstAllWActive_ItemDataBound">
    <ItemTemplate>

        <tr>
            <td><%# Eval("PollQuestion") %></td>
            <td>
                <asp:HiddenField ID="hdPollId" runat="server" Value='<%#Eval("PollId")%>' />

                <asp:ListView ID="lstOptionWPrecentage" runat="server">
                    <ItemTemplate>
                        <div class='col-md-4'>
                            <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("Id")%>' />

                            <asp:RadioButton ID="po1" runat="server" GroupName="jhhhh" ValidationGroup="poll" />
                            <label for='po1'><%# Eval("OptionText") %> </label>
                        </div>
                    </ItemTemplate>
                </asp:ListView>


            </td>
            <td><%# Eval("PollName") %>    </td>
        </tr>

    </ItemTemplate>
</asp:ListView>
VDWWD
  • 35,079
  • 22
  • 62
  • 79
user1851825
  • 31
  • 10
  • Use OnCheckedChanged event of radionbutton to clear all other radionbuttons in the list OR check this http://stackoverflow.com/questions/36807262/how-to-prevent-radiobutton-for-multiple-selection – Abdul May 17 '17 at 08:06
  • It looks like you are using a `ListView` to generate your own `RadioButtonList`. Why not use that one? – VDWWD May 17 '17 at 08:24
  • I try to use RadiobuttonList but have problem at it, so i choose this way – user1851825 May 17 '17 at 08:29
  • Welcome to the [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). – VDWWD May 17 '17 at 08:50

1 Answers1

0

thanks for helping me it's done ok as they say above

<asp:ListView ID="lstActive" runat="server" OnItemDataBound="lstActive_ItemDataBound" >
      <ItemTemplate>
 <tr>
  <td><%# Eval("PollQuestion") %></td>
     <td> <asp:HiddenField ID="hdPollId" runat="server" 
        Value='<%#Eval("PollId")%>' />
        <div class='col-md-4'>   <asp:RadioButtonList ID="RadioButtonList1" 
           runat="server" DataTextField="OptionText"  DataValueField="Id">
           </asp:RadioButtonList>
        </div>   </td>
       <td><%# Eval("PollName") %>    </td>
                       </tr>
                         </ItemTemplate>
                              </asp:ListView>
user1851825
  • 31
  • 10