views:

1850

answers:

3

I have a radio button list and some of the labels are quite long so they wrap and the second line appears underneath the radio button. Ideally I would like the text to wrap with the second line starting beneath the first character of the first line.

Any ideas on how? or would I have to make my own list based control for this?

A: 

You can take a radio button and a seperate label and set the AssociatedControlID property of that label.

<table>
    <tr>
        <td>
            <asp:RadioButton runat="server" ID="rdo" />
        </td>
        <td>
            <asp:Label runat="server" ID="lbl" Text="Radio Text" AssociatedControlID="rdo" />
        </td>
    </tr>
</table>
Kirtan
Thanks, I was hoping to not have to do even more table layout so I'm going with the style idea.
Mark Dickinson
+7  A: 

This CSS actually does the trick:

<style type="text/css">
 table.radioWithProperWrap input
 {    
      float: left;
 }

 table.radioWithProperWrap label
 {    
      margin-left: 25px;
      display: block;
 }
</style>
<asp:RadioButtonList runat="server" CssClass="radioWithProperWrap" ....>
Jose Basilio
Many thanks, I had a similar style in place that worked for IE and was just sorting which element to force to display:block when you hit the nail on the head.
Mark Dickinson
A: 

try a negative text-indent style -20px works for IE8

Fred