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"> Visa
</asp:ListItem>
<asp:ListItem Value="MasterCard">
<img src="../images/icon_mc.gif" alt="MasterCard" align="absmiddle"> Mastercard
</asp:ListItem>
</asp:RadioButtonList>
However, sometimes Visual Studio will automatically generate the following code and insert it into the ListItems:
<img src="../images/icon_visa.gif" alt="Visa" align="absmiddle"> Visa
Any idea how to do this?
+1
source to share
3 answers
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 to share
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 to share