i have nasted repeater which repeate a radio button for each questions i need make only 1 radio button in each queations this is my code , how i can make group for radio button control ?
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound" OnItemCommand="Repeater1_ItemCommand">
<ItemTemplate>
<div class="text-left" >
<strong>
<div>
<strong>
<li>
<div id="outer" style="background-color: lightblue"> <%# Eval("QuetionText")%></div>
<br />
</li>
<div>
<asp:Repeater ID="Repeater2" runat="server">
<ItemTemplate>
<li>
<div >
<asp:RadioButton ID="RadioButton1" runat="server" Text ='<%# Eval("ExamQuestionAnswerText")%>' ></asp:RadioButton>
<%--<asp:CheckBox ID="CheckBox1" runat="server" Text= '<%# Eval("ExamQuestionAnswerText")%>' />--%>
</div>
</li>
</ItemTemplate>
<FooterTemplate >
</FooterTemplate>
</asp:Repeater>
</div>
</strong>
</div>
</strong>
</div>
</ItemTemplate>
</asp:Repeater>
You can group your radio buttons in child repeater by binding its property GroupName like:
<asp:RadioButton ID="RadioButton1" runat="server" Text ='<%# Eval("ExamQuestionAnswerText")%>'
GroupName='<%# Eval("QuestionId")%>'></asp:RadioButton>
You need to bring QuestionId for dataSource of child repeater.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.