Asp. NET radio button control radiobutton Common properties and methods introduction

Source: Internet
Author: User
1. Common Properties:

(1) Checked property: used to set or return the radio button is selected, check the value is true, no check value is false.

(2) AutoCheck property: If the AutoCheck property is set to True (the default), all other radio buttons in the group are automatically cleared when the radio button is selected. For the average user, you do not need to change this property, with the default value (TRUE).

(3) Appearance property: Used to get or set the appearance of a radio button control. When the value is Appearance.Button, the radio button looks like a command button: When it is selected, it appears to have been pressed. When the value is Appearance.normal, it is the default radio button appearance.

(4) Text property: Used to set or return the text displayed within a radio button control, which can also contain an access key, which is preceded by a "&"

The letter of the symbol so that the user can select the control by pressing the ALT key and the access key at the same time.


2. Common events:

(1) Click event: When you click the radio button, the Checked property value of the radio button is set to True, and the Click event occurs.

(2) CheckedChanged event: The CheckedChanged event is triggered when the Checked property value changes.

The RadioButton in WPF may be different from those in the web, without attributes such as group. When using the same group of RadioButton directly into a groupbox or panel, they will automatically be a group, when used (to determine which one is selected) There are two ways:

The first method:

foreach (Control Ctrl-Groupbox1.controls) {if (Ctrl is RadioButton) {  if (((RadioButton) ctrl). Checked)  {   //Add the action you need  }}}

Second method: Add an event to each RadioButton

private void radioButton_CheckedChanged (object sender, EventArgs e) {RadioButton rb= (RadioButton) sender, if (RB. Checked) {     //Add the action you need                         }}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.