disable single radio button in RadioButtonList

H

headware

How can I disable a single radio button in a RadioButtonList? I tried doing this:

radioList.Items[1].Attributes.Add("disabled", "true");
radioList.Items[5].Attributes.Add("disabled", "true");

but it didn't output the correct HTML (no disabled attribute).

Thanks,
Dave
 
B

Brian W

Wild guess here..How about

radioList.Items[1].Attributes.Add("enabled", "false");
radioList.Items[5].Attributes.Add("enabled", "false");

HTH
Brian W
 
H

headware

I was trying to get the following HTML to be output by APS.NET

<FORM ACTION="whatever">
Here are some radio buttons<P>
<INPUT TYPE=RADIO NAME="btn1" VALUE="S" DISABLED>button 1<BR>
<INPUT TYPE=RADIO NAME="btn2" VALUE="M">button 2<BR>
<INPUT TYPE=RADIO NAME="btn2" VALUE="L">button 3<P>
<INPUT TYPE=SUBMIT VALUE="submit">
</FORM>

It's my understanding that "enabled" is not an attribute that the
<input> tag understands. I guess my point is that APS.NET isn't
outputing anything, whether it's valid HTML or not. No disabled=true
or even enabled=false. What am I doing wrong?


Brian W said:
Wild guess here..How about

radioList.Items[1].Attributes.Add("enabled", "false");
radioList.Items[5].Attributes.Add("enabled", "false");

HTH
Brian W



headware said:
How can I disable a single radio button in a RadioButtonList? I tried doing this:

radioList.Items[1].Attributes.Add("disabled", "true");
radioList.Items[5].Attributes.Add("disabled", "true");

but it didn't output the correct HTML (no disabled attribute).

Thanks,
Dave
 

Tim

Joined
Dec 31, 2007
Messages
4
Reaction score
0
Don't try setting disabled to false. Set disabled to disabled. Sounds strange, but that's how it works.
 

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

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top