473,394 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

radio buttons-web application

Hi this is rather a simple question but i dont know why it is creating a problem. i have two radio buttons in a panel and they have to be mutually exclusive. in windows application i know it works well. but here even though i have both the buttons in panel they are not mutually exclusive. i am able to clcik on both of then.

can any one give me a quick response for this.

Ayush.
Sep 3 '08 #1
5 1846
Curtis Rutland
3,256 Expert 2GB
Use a RadioButtonList instead of individual RadioButtons.
Sep 3 '08 #2
thanks for the reply.but this will be horizontal right. i want radio buttons to be vertically aligned.
Sep 3 '08 #3
myth0s
32
thanks for the reply.but this will be horizontal right. i want radio buttons to be vertically aligned.
You can use the GroupName attribute to specify a group of buttons that should be mutually exclusive.

Example :
Expand|Select|Wrap|Line Numbers
  1. <asp:RadioButton ID="btn1" runat="server" Text="Red" ValidationGroup="type" GroupName="color" Checked="True" />
  2. <asp:RadioButton ID="btn2" runat="server" Text="Blue" ValidationGroup="type" GroupName="color" />
  3. <asp:RadioButton ID="btn3" runat="server" Text="Green" ValidationGroup="type" GroupName="color" />
  4.  
MSDN info here : http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobutton.groupname.as px
Sep 3 '08 #4
Curtis Rutland
3,256 Expert 2GB
thanks for the reply.but this will be horizontal right. i want radio buttons to be vertically aligned.
Actually, RadioButtonList defaults to vertical. However, if you don't like that, do this:
Expand|Select|Wrap|Line Numbers
  1. <asp:RadioButtonList id="rbl1" runat="server" RepeatDirection="Horizontal" ></asp:RadioButtonList>
  2.  
You can choose between Horizontal and Vertical alignment.

There is also a RepeatColumns attribute that you can define how many columns of RadioButtons there will be.

Edit: Groupname will work, but I always find the list to be much cleaner. The only reason I use GroupName is when I don't want the radio buttons to be near each other.
Sep 3 '08 #5
Thanks for your quick replies.both the above tricks worked.

Ayush
Sep 4 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there...
2
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as...
4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
2
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
1
by: kenny8787 | last post by:
Hi, can anyone help here? I have the following code generated from a database, I want to have javascript calculate the costs of the selected items using radio buttons, subtotal the costs and...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
5
by: alanb | last post by:
Hi, hope someone can help, I need to be able to keep a running total of radio buttons selected, as a user goes through a set of 16 questions, devided in to 4 catorgories, then on "submit" have the...
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.