Net-informations.com
SiteMap  | About    

RadioButton Control

Radio button allows the user to choose only one of a predefined set of options. When a user clicks on a radio button, it becomes checked, and all other radio buttons with same group become unchecked. The buttons are grouped logically if they all share the same GroupName property.

radiobutoon-control

vb.net

  RadioButton1.Checked = True

C#

  RadioButton1.Checked = true;

Use a radio button when you want the user to choose only one option. When you want the user to choose all appropriate options, use a check box.

The following ASP.NET program gives three option button to select. When the user select any option button , the label control displays the which option button is selected.

Default.aspx

  

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>Untitled Page</title>
</head>
<body>
	<form id="form1" runat="server">
	<div>
		<asp:RadioButton ID="RadioButton1" GroupName="language" runat="server" Text="ASP.NET" /><br />
		<asp:RadioButton ID="RadioButton2" GroupName="language" runat="server" Text="VB.NET" /><br />
		<asp:RadioButton ID="RadioButton3" GroupName="language" runat="server" Text="C#" /><br />
		<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /><br />
		<asp:Label ID="Label1" runat="server" Text="Label1"></asp:Label>
	</div>
	</form>
</body>
</html>


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.cs
default.aspx.vb






net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.