I'm trying to create an online questionnaire and this is the front-end of my website
<table>
<tbody>
<asp:ListView ID="lvQuestion" runat="server" OnPagePropertiesChanged="lvQuestion_OnPagePropertiesChanged" OnPagePropertiesChanging="lvQuestion_PagePropertiesChanging">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td><%# Eval("theQuestion") %></td>
</tr>
<tr>
<td><input type="radio" name="choice" value="<%# Eval("Choice1") %>" /><%# Eval("Choice1") %></td>
<td><input type="radio" name="choice" value="<%# Eval("Choice2") %>" /><%# Eval("Choice2") %></td>
<td><input type="radio" name="choice" value="<%# Eval("Choice3") %>" /><%# Eval("Choice3") %></td>
<td><input type="radio" name="choice" value="<%# Eval("Choice4") %>" /><%# Eval("Choice4") %></td>
</tr>
</ItemTemplate>
<EmptyDataTemplate>
No data
</EmptyDataTemplate>
</asp:ListView>
</tbody>
</table>
<asp:DataPager ID="lvDataPager1" runat="server" PagedControlID="lvQuestion" PageSize="1">
<Fields>
<asp:NumericPagerField ButtonType="Link" />
</Fields>
</asp:DataPager>
I have successfully displayed the questions and its choices(using HTML5 radio buttons). However, when the user navigates from Question #1 to Question #2, the selected answer in Question #1 is lost by DataPager. I needed the selected answers to be saved in order to collect all answers using a single submit button.
You can Use
runat='server'
with providingid
to controlson Code Behind You can get these values by
You have to Find Radio Buttons inside ListView Some what like this on
ItemDataBound