ListItem color change - RB

M

mg

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>
 
M

mg

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";
}
}
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top