ASP.NET(vb.net) & RadioButton - asp:RadioButton - asp:RadioButton : Creates an individual radio button on the page. You can group multiple radio buttons together to provide a mutually exclusive set of choices.
ShotDev Focus:
- ASP.NET(vb.net) & RadioButton - asp:RadioButton
Tag Control :
<asp:RadioButton id="RadioButton1" AutoPostBack="True|False" Checked="True|False" GroupName="GroupName" Text="label" TextAlign="Right|Left" OnCheckedChanged="OnCheckedChangedMethod" runat="server"/>
Example
RadioButton.aspx
<%@ Page Language="VB" %> <script runat="server"> Sub Button1_Click(sender As Object, e As EventArgs) IF Me.RadioButton1.Checked = True Then Me.lblText1.Text = "Option 1 Checked" End IF IF Me.RadioButton2.Checked = True Then Me.lblText1.Text = "Option 2 Checked" End IF End Sub Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) IF Me.RadioButton3.Checked = True Then Me.lblText2.Text = "Option 3 Checked" End IF End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form runat="server"> <asp:RadioButton id="RadioButton1" runat="server" text="Option 1" GroupName="Group1"></asp:RadioButton> <asp:RadioButton id="RadioButton2" runat="server" text="Option 2" GroupName="Group1"></asp:RadioButton> <br> <asp:RadioButton id="RadioButton3" runat="server" text="Option 3" GroupName="Group2" AutoPostBack="true" OnCheckedChanged="RadioButton3_CheckedChanged"></asp:RadioButton> <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button> <hr /> <asp:Label id="lblText1" runat="server"></asp:Label> <br> <asp:Label id="lblText2" runat="server"></asp:Label> </form> </body> </html>
Screenshot