Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have nasted repeater which display Questions And Answer ( main Repeater Repeate Questions And Inner one Repeater Answer For Each Questions ) i wanna to make 1 Answer Only Selectable i tried
HTML
GroupName='<%# Eval("ExamQuestionAnswerId")%>'

and tried Other Unique Id's but No way Any Suggesstion Please ?

ASP.NET
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound" OnItemCommand="Repeater1_ItemCommand">
    <ItemTemplate>
        <div class="text-left" >
            

                <div>
                    
                        <li>
                             <div id="outer" style="background-color: lightblue">  <%# Eval("QuetionText")%>           (Question Level <%# Eval("QuetionLevel")%>)           <asp:LinkButton ID="LinkButton1" CommandName="DeleteQuestion" CommandArgument=<%# Eval("QuestionID") %> runat="server">Delet This Questions</asp:LinkButton></div>
                           <br />

                        </li>
                        <div>

                        <asp:Repeater ID="Repeater2" runat="server">
                            <ItemTemplate>
                                <li>

                                <div >
                                     <asp:RadioButton ID="RadioButton1" runat="server"  Text ='<%# Eval("ExamQuestionAnswerText")%>'  GroupName='<%# Eval("ExamQuestionAnswerId")%>' ></asp:RadioButton>
                                 <asp:HiddenField ID="HiddenField1" runat="server" Value ='<%# Eval("ExamQuestionAnswerIsRight")%>'></asp:HiddenField>

                                </div>
                                    </li>
                            </ItemTemplate>
                            <FooterTemplate >

                            </FooterTemplate>
                        </asp:Repeater>
                            </div>
                    
                </div>


            
        </div>
    </ItemTemplate>

</asp:Repeater>
Posted
Comments
Kornfeld Eliyahu Peter 14-Dec-14 4:04am    
Did you checked the HTML result from this markup? Does it seems to you all right?
I did not get the point "only one selectable". What exactly this means?
Kornfeld Eliyahu Peter 14-Dec-14 4:20am    
I think OP means to enable to select only one answer - I think OP try to display questions with possible answers to choose from...
Yeah, ok. :)
yallakorra 14-Dec-14 4:14am    
each question have only 1 right answer ! so inner repeater 1 radio button able to checked

 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 14-Dec-14 5:22am    
Good findings! 5+
DamithSL 14-Dec-14 5:25am    
Thank you, Kornfeld Eliyahu Peter
Try using RadioButtonList...
ASP.NET
<asp:radiobuttonlist id="RadioButtonList1" runat="server" xmlns:asp="#unknown">
  <asp:repeater id="Repeater2" runat="server">
    <itemtemplate>
      <asp:listitem><%# Eval("ExamQuestionAnswerText")%></asp:listitem>
    </itemtemplate>
  </asp:repeater>
</asp:radiobuttonlist>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900