ASP.NET - How to add a label to a RadioButtonList ListItem?

Posted by EWizard on Stack Overflow See other posts from Stack Overflow or by EWizard
Published on 2010-03-03T14:29:18Z Indexed on 2010/04/18 21:03 UTC
Read the original article Hit count: 385

I have a RadioButtonList with two ListItems included:

<asp:RadioButtonList runat="server" ID="optRollover" OnSelectedIndexChanged="RolloverOptionSelected" AutoPostBack="true">
                    <asp:ListItem Value="0">100% </asp:ListItem>
                    <asp:ListItem Value="1">Less than 100%</asp:ListItem>
</asp:RadioButtonList><br />               

On the first ListItem I need to have a label that displays some text from the code behind of the page. Logically it seems to me like I would be able to do something like this: 100%

Obviously this does not work because I am getting an error: The 'Text' property of 'asp:ListItem' does not allow child objects.

Can anyone think of a way around this constraint?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-2.0