Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why a radiobuttonlist always take a new row?

This is a question about layout. I'm developing a .net page, whenever I add a radiobuttonlist right after a label, it comes down to next row. But in the code side, it still within the same row. The problem is if you browse it in IE, it comes down to the next row. I am sure the width of both label and radiobuttonlist is not oversized. What's the reason and how to resolve this issue? Thanks in advance.

like image 584
Steven Zack Avatar asked Mar 30 '11 21:03

Steven Zack


3 Answers

Add a property to your radiobuttonlist

RepeatDirection="Horizontal"

   <asp:RadioButtonList RepeatDirection="Horizontal" 
        ID="RadioButtonList1" runat="server" style="display:inline">
        <asp:ListItem>asdf</asp:ListItem>
        <asp:ListItem>sdfg</asp:ListItem>
    </asp:RadioButtonList>

this will solve your problem. CHEERS

like image 27
Arun Thapa Avatar answered Nov 16 '22 23:11

Arun Thapa


RadioButtonList by default renders as table. You can change set the property RepeatLayout="Flow" and it will be rendered in span.

RepeatLayout Property

Different ways it can render

like image 133
gbs Avatar answered Nov 16 '22 23:11

gbs


You can set it's display style to be inline:

<asp:RadioButtonList
    ID="RadioButtonList1" runat="server" style="display:inline">
    <asp:ListItem>asdf</asp:ListItem>
    <asp:ListItem>sdfg</asp:ListItem>
</asp:RadioButtonList>

Warning: Purists will scream that information should be in a CSS class somewhere else.

like image 1
Steve Wellens Avatar answered Nov 16 '22 22:11

Steve Wellens