Link to home
Start Free TrialLog in
Avatar of VBBRett
VBBRett

asked on

Radio Button List

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.
Avatar of chaau
chaau
Flag of Australia image

Looks ok. What happens when you run the program? Do you get unexpected values?
ASKER CERTIFIED SOLUTION
Avatar of Rikin Shah
Rikin Shah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial