Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 3177 |  Welcome, Guest!   Register  Login
Home > Tutorials > ASP.NET Tutorials > RadioButton

Silverlight Tutorials | Report a Bug in the Tutorial
Found interesting? Add this to:


asp:RadioButton control
RadioButton control is used to give single select option to the user from multiple items.
 
RadioButton control is used to give single select option to the user from multiple items. When it is rendered on the page, it is implemented through <input type=radio></input> HTML tag. Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <input>.

 

Following are some important properties that are very useful.
AutoPostBack Form is automatically posted back when Radio button selection is changed.
CausesValidation true/false. If true, Form is validated if Validation control has been used in the form.
Checked true/false. If true, Radio button is selected by default.
OnCheckedChanged Fires when Radio button selection changes. This works only if AutoPostBack property is set to true.
ValidationGroup Used to put a radio button under a particular validation group. It is used when you have many set of form controls and by clicking a paricular button you want to validate a particular set of controls only.
GroupName It is used a group a set of radion buttons so only one of them can be selected at a time.
DEMO : RadioButton Show Source Code
1st set of Radio buttons without AutoPostBack
2nd set of Radio buttons with AutoPostBack
                        // 1st set of Radio buttons without AutoPostBack
                        <asp:RadioButton ID="RadioButton7" runat="Server" GroupName="1stGroup" Text="Red" Checked="True"  />
                        <asp:RadioButton ID="RadioButton8" runat="Server" GroupName="1stGroup" Text="Blue"  />
                        <asp:RadioButton ID="RadioButton9" runat="Server" GroupName="1stGroup" Text="Green" />
                    
                        // 2nd set of Radio buttons with AutoPostBack
                        <asp:RadioButton ID="RadioButton10" runat="Server" GroupName="2ndtGroup" Text="Red" Checked="True" OnCheckedChanged="FireOnCheckedChanged" AutoPostBack="true" />
                        <asp:RadioButton ID="RadioButton11" runat="Server" GroupName="2ndtGroup" Text="Blue" OnCheckedChanged="FireOnCheckedChanged" AutoPostBack="true" />
                        <asp:RadioButton ID="RadioButton12" runat="Server" GroupName="2ndtGroup" Text="Green" OnCheckedChanged="FireOnCheckedChanged" AutoPostBack="true" />                       
    
                    





About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/19/2013 7:02:03 PM