【问题标题】:asp.net Radiobutton list Descriptive textasp.net 单选按钮列表 描述性文本
【发布时间】:2016-02-09 23:46:38
【问题描述】:

这是我的代码

<asp:RadioButtonList ID="rbtnlistProgramPlans" runat="server" Font-Names="Tahoma" 
            Font-Size="Small" ForeColor="White" RepeatColumns="3" 
        style="position: relative; top: -775px; left: 0px; width: 688px;" 
        BorderStyle="None">
            <asp:ListItem Text="Practical Monthly Plan" Value="0">Monthly</asp:ListItem>
            <asp:ListItem Text="Practical 3 Month's Plan" Value="1">3 Month's</asp:ListItem>
            <asp:ListItem Text="Premium Monthly Plan" Value="2">Monthly</asp:ListItem>
            <asp:ListItem Text="Premium 3 Month's Plan" Value="3">3 Month's</asp:ListItem>
            <asp:ListItem Text="Elite Monthly Plan" Value="4">Monthly</asp:ListItem>
            <asp:ListItem Text="Elite 3 Month's Plan" Selected="True" Value="5">3 Month's</asp:ListItem>
        </asp:RadioButtonList>

我的问题是我想将ListItem Text 存储到数据库中。如果用户单击单选按钮,则相应的描述应该存储请帮助我

【问题讨论】:

  • 你能解释清楚吗?
  • 请解释更多。您希望在单击按钮或单选按钮本身的选择更改时发生这种情况?

标签: c# .net asp.net radiobuttonlist


【解决方案1】:

在 ASPX 页面上,将此代码添加到您的单选按钮列表中:

AutoPostBack = "true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged

在后面的代码中,只需连接那个事件(如果你只是双击你的单选按钮列表就会生成该事件

【讨论】:

    【解决方案2】:

    根据我对您问题的理解,您需要 SelectedItem.Text

        rbtnlistProgramPlans.SelectedItem.Text 
      // Will return Selected Radio button list Item Text
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多