Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8695517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:03:29+00:00 2026-06-13T01:03:29+00:00

I am trying to put together a polling application, I need to display a

  • 0

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?

             <asp:RadioButtonList ID="Answers" runat="server">
                <asp:ListItem Value="1" Text="<% prs['Option_1'].ToString() %>"></asp:ListItem>
                <asp:ListItem Value="2" Text="<% prs['Option_2'].ToString() %>"></asp:ListItem>
                <asp:ListItem Value="3" Text="<% prs['Option_3'].ToString() %>"></asp:ListItem>
                <asp:ListItem Value="4" Text="<% prs['Option_4'].ToString() %>"></asp:ListItem>
              </asp:RadioButtonList>

also messed around with this

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");
                }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:03:30+00:00Added an answer on June 13, 2026 at 1:03 am

    Here is one way to do it. Replace the for loop with a loop going over the answers you want to display. Create a ListItem for each item and put that into a list. Then set the list as the Datasource for the radio button list.

    var optionList = new List<ListItem>();
    
    for (var i = 0; i < 4; i++)
    {
      var newItem = new ListItem()
      {
          Value = count.ToString(),
          Text = string.Format("Option {1}", count.ToString());
      };
    
      optionList.Add(newItem);
    }
    
    Answers.DataSource = optionList;
    Answers.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to put together from a multi-tier menu from a list of menu
I'm trying to put together some career-related resources and I need access to the
I am trying to put together an application using yii-user and yii-eauth extensions but
I am currently trying to put together a simple Illustrator plugin, and coming from
I'm trying to put together an application which uses YUI's DataTable component but I
I'm trying to put together a database in SQL Server Management Studio 2008 which
I'm currently trying to put together a rich text editor that includes widgets from
I'm trying to put together (what I thought was) a simple ASP.NET web application
I trying to put together an Android app that will take a picture and
I'm trying to put together a script to monitor the MSMQ on a server.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.