disable single radio button in RadioButtonList

  • Thread starter Thread starter headware
  • Start date Start date
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
 
Wild guess here..How about

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

HTH
Brian W
 
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
 
Back
Top