2011-04-05 39 views
0

我知道這可能是非常基本的,但我似乎無法弄清楚。 我需要水平以及垂直互斥的單選按鈕。 如何將單選按鈕分配給兩個組? 在此先感謝。添加一個單選按鈕到2組

+0

你爲什麼要這麼做?我認爲可以找到這種方法的替代方案。 – Blender 2011-04-05 16:44:43

回答

0

您必須在RadioButton中設置GroupName屬性。

例如:

<asp:RadioButton ID="rbtnOne" runat="server" Text="One" GroupName="Number" /> 
<asp:RadioButton ID="rbtnTwo" runat="server" Text="Two" GroupName="Number" /> 

<asp:RadioButton ID="rbtnMan" runat="server" Text="Man" GroupName="Sex" /> 
<asp:RadioButton ID="rbtnWoman" runat="server" Text="Woman" GroupName="Sex" /> 

或使用RadioButtonList控件

<asp:RadioButtonList ID="rbtnListExample" runat="server"> 
    <asp:ListItem Text="TestOne" /> 
    <asp:ListItem Text="TestTwo" /> 
    <asp:ListItem Text="TestThree" /> 
</asp:RadioButtonList> 
相關問題