RadioButton Control

G

Guest

Hello,
How can I make RadioButtons to display all in the same row? It looks that
one Radio button per line by default.
Secondly, I was wondering if there is a way to fire up Javascript when a
Radio Button is selected. For example, depending on which Radio button gets
selected, I need to show/hide a text box. Is it something I need to use
Asp.Net AJAX (or easier way)?

Thanks....a
 
M

Masudur

Hello,
How can I make RadioButtons to display all in the same row? It looks that
one Radio button per line by default.
Secondly, I was wondering if there is a way to fire up Javascript when a
Radio Button is selected. For example, depending on which Radio button gets
selected, I need to show/hide a text box. Is it something I need to use
Asp.Net AJAX (or easier way)?

Thanks....a

hi...

why dont you use Radio Button List... and change the "RepeatDirection"
to "Horizontal"...
but if you dont want to use radioButtonList... use css to control the
flow of the radiobuttons...
drop them in single div.. and set style to display:inline;.....

about the javascript part... if you are on radio buttonlist... loop
through them items and then add onclick attribute and then set a
javascript

foreach (ListItem item in RadioButtonList1.Items)
{
item.Attributes.Add("onClick",
"window.alert('yahoo');");
}
some thing like that...
in javascript fuction hide show the textbox... depending on the radio
checked or not...

Thanks
Md. Masudur Rahman (Munna)
Kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
 
G

Guest

Thanx Masudur,
I have not added an event to a control and I assume I do this as part of
page load or init?
 
P

Peter Bucher [MVP]

Hi Ace
Secondly, I was wondering if there is a way to fire up Javascript when a
Radio Button is selected. For example, depending on which Radio button
gets
selected, I need to show/hide a text box. Is it something I need to use
Asp.Net AJAX (or easier way)?
The RadioButtonList provides a property named "AutoPostBack".
If the property set to true, a postback through javascript fired.
-
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.autopostback.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top