Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ListItem color change - RB

Reply
Thread Tools

ListItem color change - RB

 
 
mg
Guest
Posts: n/a
 
      11-11-2003
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>

 
Reply With Quote
 
 
 
 
mg
Guest
Posts: n/a
 
      11-11-2003
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>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<asp:ListItem Value="0">blank choice</asp:ListItem> ? Jim in Arizona ASP .Net 7 11-22-2006 08:31 AM
ropdownlist listitem.value not working - returns listitem.text instead Mad Scientist Jr ASP .Net 2 06-29-2004 01:13 PM
How do I change a listitem font color? Do ASP .Net 1 12-08-2003 05:58 PM
Changing background-color of a ListItem Tom ASP .Net 0 12-03-2003 02:31 PM
ListItem color change - RB mg ASP .Net 4 11-12-2003 11:58 AM



Advertisments