Solved

Radio Button in User Control

Posted on 2010-09-08
4
648 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

12 Experts available now in Live!

Get 1:1 Help Now