title: Use data from database to populate RadioButtonList
body: <p>I am trying to put together a polling application, I need to display a radio button list with options pulled from a database (Option_1, Option_2, etc) but I need the radio button value to be 1, 2, 3, 4 as when it gets submitted it will get inserted into another database that holds the poll results. I have been playing around with this code here and I can't get the Option text to show next to the Radio button. Any suggestions?</p>
  
  <pre><code>             &lt;asp:RadioButtonList ID="Answers" runat="server"&gt;
                  &lt;asp:ListItem Value="1" Text="&lt;% prs['Option_1'].ToString() %&gt;"&gt;&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem Value="2" Text="&lt;% prs['Option_2'].ToString() %&gt;"&gt;&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem Value="3" Text="&lt;% prs['Option_3'].ToString() %&gt;"&gt;&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem Value="4" Text="&lt;% prs['Option_4'].ToString() %&gt;"&gt;&lt;/asp:ListItem&gt;
                &lt;/asp:RadioButtonList&gt;
  </code></pre>
  
  <p>also messed around with this</p>
  
  <pre><code>var op1 = prs["Option_1"].ToString();
                  var op2 = prs["Option_2"].ToString();
                  var op3 = prs["Option_3"].ToString();
                  var op4 = prs["Option_4"].ToString();
  
                  if (op1 != "")
                  {
                      Answers.Items.Add("1");
                  }
                  if (op2 != "")
                  {
                      Answers.Items.Add("2");
                  }
                  if (op3 != "")
                  {
                      Answers.Items.Add("3");
                  }
                  if (op4 != "")
                  {
                      Answers.Items.Add("4");
                  }
  </code></pre>