disable single radio button in RadioButtonList

Discussion in 'ASP .Net' started by headware, Nov 12, 2003.

  1. headware

    headware Guest

    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
    headware, Nov 12, 2003
    #1
    1. Advertising

  2. headware

    Brian W Guest

    Wild guess here..How about

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

    HTH
    Brian W



    "headware" <> wrote in message
    news:...
    > 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
    Brian W, Nov 12, 2003
    #2
    1. Advertising

  3. headware

    headware Guest

    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" <brianw@gold_death_2_spam_rush.com> wrote in message news:<#>...
    > Wild guess here..How about
    >
    > radioList.Items[1].Attributes.Add("enabled", "false");
    > radioList.Items[5].Attributes.Add("enabled", "false");
    >
    > HTH
    > Brian W
    >
    >
    >
    > "headware" <> wrote in message
    > news:...
    > > 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
    headware, Nov 13, 2003
    #3
  4. headware

    Tim

    Joined:
    Dec 31, 2007
    Messages:
    4
    Don't try setting disabled to false. Set disabled to disabled. Sounds strange, but that's how it works.
    Tim, Sep 16, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    5,303
    alex bowers
    Nov 18, 2003
  2. psb
    Replies:
    2
    Views:
    17,009
    Achintya Jha
    Sep 22, 2004
  3. Ryan Taylor
    Replies:
    2
    Views:
    14,594
    maclade
    Mar 20, 2008
  4. darrel
    Replies:
    2
    Views:
    690
    Bruce Barker
    Mar 24, 2005
  5. Hiten
    Replies:
    1
    Views:
    607
    Vidar Petursson
    May 26, 2004
Loading...

Share This Page