简体   繁体   English

asp.net 单选按钮列表 描述性文本

[英]asp.net Radiobutton list Descriptive text

This is my code这是我的代码

<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>

My problem is i want to store ListItem Text into database.if the user clicks on radio button the corresponding discriptive should store Please help me guys我的问题是我想将ListItem Text存储到数据库中。如果用户单击单选按钮,则应存储相应的描述性请帮帮我

On the ASPX page, add this code to your radiobuttonlist:在 ASPX 页面上,将此代码添加到您的单选按钮列表中:

AutoPostBack = "true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged

On the code behind, just hook up that event (the event is generated if you just double click on your radiobuttonlist在后面的代码中,只需连接该事件(如果您只是双击您的单选按钮列表,则会生成该事件

From what I understand of your question, you need the SelectedItem.Text根据我对您问题的理解,您需要 SelectedItem.Text

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM