HHWitz
December 29, 2006, 2:51pm
1
Morning,
I’m trying to attach images to the text of my Radio buttons. There seems to be a way to do this but unfortunately when one does this the HTLM generated is tables. For accessibility purposes this does not meet my needs. Is there any other way to do this?
Thanks
Henry
Rob_D
December 29, 2006, 3:03pm
2
Afternoon!
It sounds like WYSIWYG software is generating the code.
Do you mean you want to use an image instead of text next to the radio button?
In which case, do this:
<input name="name" type="radio" value="value" /><img src="yourimage.jpg" alt="whatthebuttonmeans" />
HHWitz
December 29, 2006, 3:15pm
3
This is my source
<asp:RadioButtonList ID="rbPaymentMethods" runat="server">
<asp:ListItem>Check<img src="images/personalchecklrg.gif" alt="whatthebuttonmeans" /></asp:ListItem>
<asp:ListItem>Credit Card</asp:ListItem>
</asp:RadioButtonList>
When the page is rendered this is what appears as the source
<table id=“ctl00_ContentPlaceHolder1_rbPaymentMethods” border=“0”>
<tr>
<td><input id=“ctl00_ContentPlaceHolder1_rbPaymentMethods_0” type=“radio” name=“ctl00$ContentPlaceHolder1$rbPaymentMethods” value=“Check<img src="images/personalchecklrg.gif" alt="whatthebuttonmeans" />” /><label for=“ctl00_ContentPlaceHolder1_rbPaymentMethods_0”>Check<img src=“images/personalchecklrg.gif” alt=“whatthebuttonmeans” /></label></td>
</tr><tr>
<td><input id=“ctl00_ContentPlaceHolder1_rbPaymentMethods_1” type=“radio” name=“ctl00$ContentPlaceHolder1$rbPaymentMethods” value=“Credit Card” /><label for=“ctl00_ContentPlaceHolder1_rbPaymentMethods_1”>Credit Card</label></td>
</tr>
</table>
HHWitz
December 29, 2006, 3:20pm
4
Looking at it now it appears the Radio button list generates tables even if one does not include an image
Rob_D
December 29, 2006, 3:19pm
5
I don’t know about ASP. How is this code being generated? What software are you using?
Rob_D
December 29, 2006, 3:21pm
6
There you go then. Anyone out there who can help get rid of these unecessary tables?
HHWitz
December 29, 2006, 3:21pm
7
Visual Studio 2005 ASP.NET 2.0
HHWitz
December 29, 2006, 3:29pm
8
For all those interested:
There is a property on the RadioButtonLIST called RepeatLayout, it defaults to Table change this to Flow if you don’t want tables.