ASP.NET RadioButtonList generates additional HTML for the ListItem which contains the image

In my application, I have a RadioButtonList:

<asp:RadioButtonList runat="server" ID="CardTypeRadioButtonList" RepeatDirection="Horizontal">
    <asp:ListItem Value="Visa">
        <img src="../images/icon_visa.gif" alt="Visa" align="absmiddle">&nbsp;Visa
    </asp:ListItem>
    <asp:ListItem Value="MasterCard">
        <img src="../images/icon_mc.gif" alt="MasterCard" align="absmiddle">&nbsp;Mastercard
    </asp:ListItem>
</asp:RadioButtonList>

      

However, sometimes Visual Studio will automatically generate the following code and insert it into the ListItems:

&lt;img src=&quot;../images/icon_visa.gif&quot; alt=&quot;Visa&quot; align=&quot;absmiddle&quot;&gt;&#160;Visa 

      

Any idea how to do this?

+1


source to share


3 answers


I tried to put an empty Text attribute on each ListItem. Hopefully this clears up this question.



+1


source


you are missing the '<' in the second "img" tag

<asp:RadioButtonList runat="server" ID="CardTypeRadioButtonList" RepeatDirection="Horizontal">
<asp:ListItem Value="Visa">
    <img src="../images/icon_visa.gif" alt="Visa" align="absmiddle"> Visa
</asp:ListItem>
<asp:ListItem Value="MasterCard">
   <img src="../images/icon_mc.gif" alt="MasterCard" align="absmiddle"> Mastercard
</asp:ListItem>

      



0


source


I had a similar problem with Telerik bodies about a year ago and ended up writing a macro to fix it as needed because I couldn't figure it out. This isn't the best solution, but if you can't figure out what to do, it's very easy to create a macro to fix the code as needed in Visual Studio.

0


source







All Articles