我需要知道RadioButton和RadioButtonList之間的區別,以及在決定使用哪個準則時使用的準則是什麼?RadioButon和RadioButtonList有什麼不同?
我研究這一點,並決定在這裏發表我的發現幫助說明我發現應該有助於澄清我的問題的差異:
我學會了什麼:
單選
使用一次顯示一個單獨的RadioButton。可能需要設置組屬性以將多個RadioButton控件關聯到一個組中。
RadioButtonList的
用於顯示一組單選按鈕控件,自動地提供該組屬性相關聯的所有包括單選按鈕控制成一個單一的基。
觀察
在視覺上,都產生相同的結果在用戶界面中,所提供的一個地方至少2個或更多單選按鈕與該組屬性的值相同的頁面上控制。
UI示例代碼如下
ASP:單選
<asp:RadioButton ID="b2b" text="B to B" checked="true" runat ="server" GroupName="businesstype" />
<asp:RadioButton ID="b2c" text="B to C" runat ="server" GroupName="businesstype" />
ASP:RadioButtonList的
<asp:RadioButtonList ID="businesstype" runat="server" >
<asp:ListItem Selected="True" Value="0">B to B</asp:ListItem>
<asp:ListItem Value="1">B to C</asp:ListItem>
</asp:RadioButtonList>
什麼是使用各的指引?
想知道反對的原因(除了問題中的措辭外)?這對我很有用,並且從對這個問題的確切標題的良好搜索中出現。如果對問題措辭/文辭進行倒票 - 那爲什麼不編輯問題而不是倒票呢?我今天下班後需要一些時間來編輯這個問題。 – condiosluzverde 2017-11-15 21:01:49