Why a radiobuttonlist always take a new row?
Asked Answered
B

4

15

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.

Bombast answered 30/3, 2011 at 21:25 Comment(0)
E
25

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

Eiderdown answered 30/3, 2011 at 22:23 Comment(0)
H
13

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

Heracliteanism answered 18/12, 2012 at 5:35 Comment(0)
C
1

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.

Corroborant answered 30/3, 2011 at 21:29 Comment(3)
in ASP.net, nobody can hear you scream.Chibchan
especially when the solution that you propose doesn't work :-PShrieval
Yes it does, perhaps you didn't read the original post carefully. BTW: Replying to a post 7 months old is considered necro-posting by many.Corroborant
N
0

if you have apply css on page, then it is hard to maintain style of radiobuttonlist.

Mine was fix with below code

#radiobuttonlist label
{
   vertical-align: super;
}
Nary answered 25/3, 2016 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.