简体   繁体   English

ASP RadioButtonList元素下的内联

[英]ASP RadioButtonList Inline Below Element

I'm wondering if it is possible to create an ASP RadioButtonList where the list in inline and the radio button is below the element, a label or div for example. 我想知道是否可以创建一个ASP RadioButtonList ,其中内联列表和单选按钮位于元素(例如labeldiv )下方。

I have tried 我努力了

<asp:RadioButtonList runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
    <asp:ListItem Text="Label1" Value="1" Selected="True"><div class="box">stuff</div></asp:ListItem>
    <asp:ListItem Text="Label2" Value="2"><div class="box">stuff</div></asp:ListItem>
    <asp:ListItem Text="Label3" Value="3"><div class="box">stuff</div></asp:ListItem>
    <asp:ListItem Text="Label4" Value="4"><div class="box">stuff</div></asp:ListItem>
    <asp:ListItem Text="Label5" Value="5"><div class="box">stuff</div></asp:ListItem>
</asp:RadioButtonList>

But the label always comes before the div element, whereas, I would need the div before the label . 但是标签始终位于div元素之前,而我需要div位于label之前。 Any suggestions? 有什么建议么?

Well..... it's not very customizable. 嗯.....不是非常可定制的。 I would suggest using a <asp:RadioButton /> with a GroupName="YYY" setting instead, because that would give you the control that you need, which you do not get with the list form. 我建议改为使用带有GroupName="YYY"设置的<asp:RadioButton /> ,因为那样可以为您提供所需的控件,而列表表单无法提供该控件。 The RadioButton has a TextAlign that can set the text alignment in relation to the radio button, which may be helpful to your needs, but you can't set that for the list item, only the RadioButton control. RadioButton具有TextAlign,它可以设置与单选按钮相关的文本对齐方式,这可能对您的需求有所帮助,但您不能仅对RadioButton控件设置列表项的对齐方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM