Solved

Radio Button List

Posted on 2013-01-23
3
481 Views
Last Modified: 2013-01-24
I am using a radio button list to be able to send a string to a process so that a site gets created with the proper string.  I need a radio button list that has the following in it:

projects
claims
sites

I did in fact create a radio button list that has the list of things above, but I am concerned that it is not pulling the proper string in code to use.  Here is what I have in my asp:radiobuttonlist:

<asp:RadioButtonList ID="rblContentType" runat="server"
                style="margin-left:400px; margin-top:-22px;" RepeatDirection="Horizontal"
                ValidationGroup="SiteNameValidate">
                <asp:ListItem Value ="projects" Text="projects"></asp:ListItem>
                <asp:ListItem Value="claims" Text="claims"></asp:ListItem>
                <asp:ListItem Value="sites" Text="sites"></asp:ListItem>
             </asp:RadioButtonList>

How would I pull the proper value for what is selected in my code?  I have the following:

 string siteoptionname = rblContentType.SelectedItem.Text;

Is this correct?  If a user selects projects, I want "projects" string to be used, if the user selects "claims" I want claims to be used and if a user selects sites, I want the string "sites" to be used.
0
Comment
Question by:VBBRett
3 Comments
 
LVL 24

Expert Comment

by:chaau
ID: 38812757
Looks ok. What happens when you run the program? Do you get unexpected values?
0
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 500 total points
ID: 38814519
Hi,

string siteoptionname = rblContentType.SelectedValue; should do the thing!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now