将一个单选按钮添加到2组中

时间:2011-04-05 16:38:54

标签: html-parsing

我知道这可能是非常基本的,但我似乎无法弄明白。 我需要水平和垂直互斥的单选按钮。 如何为两组分配单选按钮? 提前谢谢。

1 个答案:

答案 0 :(得分: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>
相关问题