By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,152 Members | 2,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,152 IT Pros & Developers. It's quick & easy.

How to get each rows radio button value from data list?

P: 3
I want to put some questions with a data list view with multiple choice radio button so how to get each question answer or checked radio button value from list?
i have this asp code:
Expand|Select|Wrap|Line Numbers
  1. <asp:DataList ID="DataList1" runat="server" BackColor="White"
  2.             BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
  3.             DataKeyField="Qno" DataSourceID="SqlDataSource1" GridLines="Horizontal" 
  4.             HorizontalAlign="Center" Font-Bold="False" Font-Italic="False" 
  5.             Font-Overline="False" Font-Size="Larger" Font-Strikeout="False" 
  6.             Font-Underline="False">
  7.             <EditItemStyle HorizontalAlign="Left" />
  8.             <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
  9.             <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
  10.             <ItemStyle BackColor="White" ForeColor="#330099" />
  11.             <ItemTemplate>
  12.                 Qno:
  13.                 <asp:Label ID="QnoLabel" runat="server" Text='<%# Eval("Qno") %>' />
  14.                 <br />
  15.                 Question:
  16.                 <asp:Label ID="QuestionLabel" runat="server" Text='<%# Eval("Question") %>' />
  17.                 <br />
  18.                 Ans1:
  19.                 <asp:RadioButton ID="RadioButton1" GroupName="gp" Text='<%# Eval("Ans1") %>' runat="server" />
  20.                 <br />
  21.                 Ans2:
  22.                 <asp:RadioButton ID="RadioButton2" GroupName="gp" runat="server" Text='<%# Eval("Ans2") %>' />
  23.                 <br />
  24.                 Ans3:
  25.                 <asp:RadioButton ID="RadioButton3" GroupName="gp" runat="server" Text='<%# Eval("Ans3") %>' />
  26.                 <br />
  27.                 Ans4:
  28.                 <asp:RadioButton ID="RadioButton4" GroupName="gp" runat="server" Text='<%# Eval("Ans4") %>' />
  29.                 <br />
  30.                 Answer:
  31.                 <asp:Label ID="AnswerLabel" runat="server" Text='<%# Eval("Answer") %>' />
  32.                 <br />
  33.                 <br />
  34.             </ItemTemplate>
  35.             <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
  36.             <SeparatorStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" 
  37.                 Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Right" />
  38.         </asp:DataList>
Any help will be highly appreciated.
Mar 30 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.