Solved

Radio Button in User Control

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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