2011-07-27 140 views
9

我无法实现radiobuttonlist所需的布局。我希望输出看起来像下面的图片。单选按钮列表布局ASP .Net

这里是我想要实现的链接:

http://skitch.com/hiraldesai/fcfn9/radio-button-layout

这里是我的代码试图实现上述目标,但我不能够得到单选按钮上面的文本编程。这是一个CSS的东西?我尝试了许多不同的RepeatLayout,RepeatDirection,RepeatColumns,TextAlign等组合。

AnswerRadioButtons.RepeatLayout = RepeatLayout.Table 
AnswerRadioButtons.RepeatDirection = RepeatDirection.Horizontal        

感谢您的建议。

回答

13

我能用这个测试做到这一点。

<asp:RadioButtonList ID="rbl" runat="server" RepeatDirection="Horizontal" 
     RepeatLayout="Table" CssClass="RBL" TextAlign="Left"> 
    <asp:ListItem Text="radio button 1" /> 
    <asp:ListItem Text="radio button 1" /> 
    <asp:ListItem Text="radio button 1" /> 
</asp:RadioButtonList> 

利用该CSS

.RBL label 
{ 
    display: block; 
} 

.RBL td 
{ 
    text-align: center; 
    width: 20px; 
} 
+0

和垂直对齐:底部;为.RBL td风格 –