Get selected RadioButton (C#) : RadioButton « Asp Control « ASP.Net






Get selected RadioButton (C#)

<%@ Page Language="C#" %>
<script runat="server">

    void Page_Load()
     {
     if (Page.IsPostBack)
      Message.Text = "You have selected " + radCity.SelectedItem.Value;
    }

</script>
<html>
<head>
    <title>Radio Button List Example</title>
</head>
<body>
    <asp:Label id="Message" runat="server"></asp:Label>
    <br />
    <br />
    Which city interests you? 
    <br />
    <br />
    <form runat="server">
        <asp:radiobuttonlist id="radCity" runat="server">
            <asp:listitem id="optA" runat="server" value="A" />
            <asp:listitem id="optB" runat="server" value="B" />
            <asp:listitem id="optC" runat="server" value="C" />
        </asp:radiobuttonlist>
        <br />
        <input type="submit" value="Submit Query" />
    </form>
</body>
</html>

           
       








Related examples in the same category

1.On asp:radiobutton selection state changed (VB.net)
2.asp:radiobutton: group name (VB.net)
3.asp:radiobutton: text align (VB.net)
4.Set asp:radiobutton checked (VB.net)
5.Font-Size, Font-Bold, Font-Name for radio button (VB.net)
6.GroupName for asp:radiobutton (VB.net)
7.Check a asp:radiobutton (VB.net)
8.Radio button auto post back (C#)
9.Watch TextBox, CheckBox and radiobutton auto post back action (C#)
10.Use 'Switch' to read Radio Button Choice (C#)
11.Read RadioButton selection (C#)