Asp.net Radio Button control


asp:RadioButton control

RadioButton control is utilized to give single select alternative to the client from different things.

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.
AutoPostBackForm is automatically posted back when Radio button selection is changed.
CausesValidationtrue/false. If true, Form is validated if Validation control has been used in the form.
Checkedtrue/false. If true, Radio button is selected by default.
OnCheckedChangedFires when Radio button selection changes. This works only if AutoPostBack property is set to true.
ValidationGroupUsed 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.
GroupNameIt is used a group a set of radion buttons so only one of them can be selected at a time.


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" />                     
   
                    
Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment