Solved

Radio Button List

Posted on 2013-01-23
3
485 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

786 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