【问题标题】:Radio Buttons in ASP.NETASP.NET 中的单选按钮
【发布时间】:2011-01-13 11:14:11
【问题描述】:

我对 .NET 有点陌生。 我在网页的面板内使用单选按钮。 (因为组框不存在)。 但是当我点击每个单选按钮时,它们都会被选中。他们不是作为一个群体,而是作为一个单位。

我需要在此处移除面板吗?请帮帮我。

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    您可能缺少组名

    <asp:RadioButton id="button1" runat="server" GroupName="MyGroup" Text="Button 1" />
    <asp:RadioButton id="button2" runat="server" GroupName="MyGroup" Text="Button 2" />
    <asp:RadioButton id="button3" runat="server" GroupName="MyGroup" Text="Button 3" />
    

    【讨论】:

    • 谢谢...我也试试这个。
    【解决方案2】:

    您可以使用 ASP.NET 工具栏中的单选按钮列表

    radiobuttonlist 的 SelectedIndexChanged 事件中,您可以随心所欲地做任何事情。 (rblist 是 单选按钮列表

    protected void rbList_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (rbList.Items[0].Selected)
        {
            lblHeader.Text = "You selected first option";
        }
    }
    

    【讨论】:

    • 感谢 JCTLK... 这很有用。
    【解决方案3】:

    你想要的是&lt;asp:RadioButtonList&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-03
      • 2011-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多