RadioButtonList Renders Differently in 2.0 than 1.1

J

Joe Fallon

I tried Google to see if this has been an issue for other people but did not
find anything.
In my ASP.Net 1.1 application the radio button list renders the way I want
it.
But after converting to 2.0, the same control renders differently.

<asp:radiobuttonlist id="opgAction" runat="server" BorderStyle="None"
Font-Bold="False" RepeatLayout="Flow">
<asp:LISTITEM Value="A">&nbsp;&nbsp;</asp:LISTITEM>
<asp:LISTITEM Selected="True" Value="R">&nbsp;&nbsp;</asp:LISTITEM>
<asp:LISTITEM Value="G">&nbsp;&nbsp;</asp:LISTITEM>
<asp:LISTITEM Value="H">&nbsp;</asp:LISTITEM>
</asp:radiobuttonlist>

The first list item is rendered like this in 1.1 (notice that the label has
a blank value between the tags):
<input id= "rptr1__ctl1_rptr2__ctl0_opgAction_0" type="radio"
name="rptr1:_ctl1:rptr2:_ctl0:blush:pgAction" value="A"/>
<label for="rptr1__ctl1_rptr2__ctl0_opgAction_0"> </label>

But in 2.0 it renders like this (notice that the labe has an A between the
tags):
<input id= "rptr1__ctl1_rptr2__ctl0_opgAction_0" type="radio"
name="rptr1:_ctl1:rptr2:_ctl0:blush:pgAction" value="A"/>
<label for="rptr1__ctl1_rptr2__ctl0_opgAction_0">A</label>

I do not want the A to be between the label tags. I do not want the Values
to appear on the screen.

Is there something I can change in the control to get it to render the old
way?
Is there some code or script I can write to modify this behavior?
Anyone else ever have a problem with this?
 
J

Joe Fallon

The answer to the problem is to move the &nbsp; from between the tags to the
Text property instead:

<asp:LISTITEM Value="A" Text="&nbsp;&nbsp;"></asp:LISTITEM>
 

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

Top