简体   繁体   中英

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

On the ASPX page, add this code to your radiobuttonlist:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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