简体   繁体   中英

How to use radio button with dynamic list view?

I am trying to make an online test system, where questions and options are added from database to list view. plz tell me how can i use radio button to check if question was correct or not. this is the code i am using:-

<asp:listview ID="Listview1" runat="server">
<LayoutTemplate>
<ul class="row" style="list-style:none;">
<asp:PlaceHolder ID="itemPlaceholder" runat="server">
</asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<li>
<div class="row1">
Q. <%#Eval("question") %>><br />
<asp:RadioButton ID="RadioButton1 runat="server" /><%#Eval("op1") %>>
<br />
<asp:RadioButton ID="RadioButton2" runat="server" /><%#Eval("op2") %>>
<br />
<asp:RadioButton ID="RadioButton3" runat="server" /><%#Eval("op3") %>>
<br />
<asp:RadioButton ID="RadioButton4" runat="server" /><%#Eval("op4") %>>
</div>
</li>
</ItemTemplate>
</asp:listview>

由于要动态加载选项,因此必须在回发之后使用Request["RadioButton1"]获取值

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM