ListItem color change - RB

Discussion in 'ASP .Net Web Controls' started by mg, Nov 11, 2003.

  1. mg

    mg Guest

    How can I change the color of the display text beside a
    single ListItem of a RadioButtonList when the associated
    radiobutton is selected - hopefully using C# in the
    codebehind of a WebForm?

    <asp:RadioButtonList id="RadioButtonList1" ........ >
    <asp:ListItem Value="Yes">Yes</asp:ListItem>
    <asp:ListItem Value="No">No</asp:ListItem>
    <asp:ListItem Value="Maybe">Maybe</asp:ListItem>
    </asp:RadioButtonList>
     
    mg, Nov 11, 2003
    #1
    1. Advertising

  2. mg

    mg Guest

    I've had no luck with the following code ???

    private void RadioButtonList1_SelectedIndexChanged( ...
    foreach (ListItem li in RadioButtonList1.Items)
    {
    if (li.Selected==true)
    {
    li.Attributes["ForeColor"] = "red";
    }
    }


    >-----Original Message-----
    >How can I change the color of the display text beside a
    >single ListItem of a RadioButtonList when the associated
    >radiobutton is selected - hopefully using C# in the
    >codebehind of a WebForm?
    >
    ><asp:RadioButtonList id="RadioButtonList1" ........ >
    ><asp:ListItem Value="Yes">Yes</asp:ListItem>
    ><asp:ListItem Value="No">No</asp:ListItem>
    ><asp:ListItem Value="Maybe">Maybe</asp:ListItem>
    ></asp:RadioButtonList>
    >
    >.
    >
     
    mg, Nov 11, 2003
    #2
    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. mg

    ListItem color change - RB

    mg, Nov 11, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    7,741
  2. Do
    Replies:
    1
    Views:
    8,535
    Munsifali Rashid
    Dec 8, 2003
  3. Mad Scientist Jr
    Replies:
    2
    Views:
    470
    Mad Scientist Jr
    Jun 29, 2004
  4. Jim in Arizona
    Replies:
    7
    Views:
    946
    Badass Scotsman
    Nov 22, 2006
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    430
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page