Solved

Radio Button in User Control

Posted on 2010-09-08
4
653 Views
Last Modified: 2012-05-10
Hi..
I have user control that has a single radio button.  My page loads the control(s) but depending on the data and loads more than 1 of the same control.. up to 5.  My problem is that after the controls are loaded the radio buttons are not in 'synch'  - I can select multiple values - I need to controls to act like 1 single radio group so only 1 button of the controls can be selected.
Any ideas
thanks

0
Comment
Question by:JElster
  • 2
  • 2
4 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 33625734
Giving all the radio buttons the same name attribute should group them.
0
 
LVL 1

Author Comment

by:JElster
ID: 33625805
I tried that - I thought it should work too...

    <asp:RadioButton ID="radDEFAULTADDRESS" runat="server" ForeColor="Black" Name="grpAddress" Text="Default Address" TabIndex="-1" />
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 33626106
Actually it shoud be GroupName="grpAddress", but it still does not work because each radio button group name is prefixed with an id, and the id will always be unique. Even if you do not assign a group name, one is automatically rendered for each radio button added via the same user control.

One possibility is to use a standard html input radio button with a group name in the user control. Then upon submit, use javascript to determine which one is checked.
0
 
LVL 1

Author Comment

by:JElster
ID: 33626181
I found this.. which I think does it....

http://www.codeproject.com/KB/webforms/How_group_RButtons.aspx
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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