Asp.net

單選按鈕列表佈局 ASP .Net

  • July 15, 2014

我無法為單選按鈕列表實現所需的佈局。我希望輸出看起來像下圖。

這是我要實現的目標的連結:

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

這是我試圖實現上述目標的程式碼,但我無法以程式方式獲取單選按鈕上方的文本。這是CSS的東西嗎?我嘗試了許多不同的 RepeatLayout、RepeatDirection、RepeatColumns、TextAlign 等組合。

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

感謝您的建議。

我能夠通過這個測試做到這一點。

<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;
}

引用自:https://stackoverflow.com/questions/6849794