*Resolved* Select Radio Button When Text Next to it is Clicked
Hi ....
What I'm trying to do should be simple. I have two radio buttons on an aspx page with text beside each explaining what the radio buttons mean. Of course, the radio buttons work correctly when clicked. Here's what I want to do ... when the text next to a radio button is clicked, I want the radio button itself to be selected. I've tried label and text box controls, but neither has a click event. Does anyone know how to do this?
Thanks,
OneSource
Re: Select Radio Button When Text Next to it is Clicked
My radio buttons seem to work exactly how you describe you want them to work. The text next to the radiobutton selects the radio button when clicked.
I'm not trying to be rude, but you set the text for the radio button properly right? the radiobutton has a text property and radiobutton lists has an item collection.
Re: Select Radio Button When Text Next to it is Clicked
token, I thought that I was going to be a candidate for the duh! award, but this isn't an asp:radiobutton control. It's of the type INPUT type="radio", which doesn't have a text property. :ehh: So, I still don't know how to do it ...
Re: Select Radio Button When Text Next to it is Clicked
oooh, sorry man, i wish that i could help. I have no idea, i dont have time now to try it out, if it is really important maybe you can create some javascript that will change the property of the radiobutton when you click the text after you make it a link. Seems like a whole lot of work for very little.
Is there any particular reason why you dont want to use the asp radio button control
Re: Select Radio Button When Text Next to it is Clicked
Quote:
Is there any particular reason why you dont want to use the asp radio button control
I'm taking over this app that was created by a different developer; therefore, I don't want to play around with it too much because something may break ... :o
Re: Select Radio Button When Text Next to it is Clicked
Place the text next to the radio button in a div tag. In the onClick event for the div, toggle the radio button using client side javascript.
Re: Select Radio Button When Text Next to it is Clicked
mendhak et all ... I figured out what the problem was! a silly "}" missing in the javascript code! arghhhh .... I said it was silly!
Thanks anyway!
Re: Select Radio Button When Text Next to it is Clicked
you could make it a lot easier on yourself and just use a LinkLabel to display the text, then do myradiobutton.Select in the click event for the LinkLabel
Re: Select Radio Button When Text Next to it is Clicked
syntax-error, I'll do some research on a LinkLabel.
Thanks, OS (OneSource!)
Re: Select Radio Button When Text Next to it is Clicked
Check out a video on the LinkLabel control at VB @ the Movies (its in the "Controls" section),
http://msdn.microsoft.com/vbasic/atthemovies/
Re: *Resolved* Select Radio Button When Text Next to it is Clicked
Thanks syntax-error, I didn't know about VB @ The Movies!