asp.net - 内联显示单选按钮列表

标签 asp.net css radiobuttonlist

我的页面上有一些广播列表。我面临的问题是单选按钮的文本没有显示在单选按钮的内联中。我已将 repeatLayout 放到 Table 和 Flow 中,但都不起作用。我试图添加一种显示样式:内联;但这也不起作用(尽管它在复选框上起作用,我认为它可能在这里也起作用)。

这只是一个普通的广播列表:

<asp:RadioButtonList ID="radRace" CssClass="radioButtonList" runat="server" RepeatDirection="Horizontal">
    <asp:ListItem>Race 1</asp:ListItem>
    <asp:ListItem>Race 2</asp:ListItem>
    <asp:ListItem>Race 3</asp:ListItem>
    <asp:ListItem>Race 4</asp:ListItem>
</asp:RadioButtonList>

ul.radioButtonList { list-style:none; margin: 0; padding: 0;}
ul.radioButtonList.horizontal li { display: inline;}

当 repeatLayout 在 table 上时:

enter image description here

当 repeatLayout 在 Flow 上时:

enter image description here

有人可以帮助我如何设置它,以便文本显示在单选按钮旁边......如果它有所不同,radioButtonList 在表格中....


解决方案:

这是单选按钮列表现在的样子:

<asp:RadioButtonList ID="radRace" CssClass="radioButtonList" runat="server" RepeatDirection="Horizontal">
    <asp:ListItem>Race 1</asp:ListItem>
    <asp:ListItem>Race 2</asp:ListItem>
    <asp:ListItem>Race 3</asp:ListItem>
    <asp:ListItem>Race 4</asp:ListItem>
</asp:RadioButtonList>

这是 cssClass:

<style type="text/css">
    .radioButtonList { list-style:none; margin: 0; padding: 0;}
    .radioButtonList.horizontal li { display: inline;}

    .radioButtonList label{
        display:inline;
    }
</style>

最佳答案

Check the solution suggested by Aroon Soraali:

<asp:RadioButtonList RepeatDirection="Horizontal" ID="rblFilterType" runat="server"/>

关于asp.net - 内联显示单选按钮列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17670479/

相关文章:

c# - 在多个 ListBox 控件之间移动项目

javascript - 如何使用变量的值更改文本及其颜色 (i)

css - ARIA 角色在 IE8 中不起作用?

c# - 如何将自定义属性添加到 RadioButtonList 项目?

javascript - 禁用 Jquery 中单选列表控件中的单选按钮

c# - 基于 Microsoft Word 模板生成 PDF 文档

asp.net - 尝试使 Web 方法异步

jquery - 在asp.net类库中使用ckeditor

css - 如何通过悬停或单击制作 'active' 导航图标?

javascript - ASP.NET RadioButtonList 和渐进式增强