Asp. NET WebForm Component CheckBoxList programming (1)

Source: Internet
Author: User
The checkbox selection component is a common component in a program. This component is used in programming, and is usually not used in any way, often in the form of multiple such components. If you are using multiple checkbox components in a asp.net page, there is a convenient way to use the CheckBoxList component in addition to adding multiple checkbox components to the page. The CheckBoxList component consists of a set of checkbox components in which the checkbox appears as an entry and has an index number for each checkbox in the CheckBoxList assembly, which is easier to process in the program.

You may ask, this is not superfluous, since there is a CheckBox component, but also CheckBoxList components to do? This is because in the process of programming, it is often much easier and more obvious to process CheckBoxList components than to process the checkbox components. Examples are as follows:

Suppose you have a CheckBoxList component and 10 checkbox components, and this CheckBoxList component is made up of these 10 checkbox components. To detect which of these 10 checkbox components have been selected, if the checkbox component selected in the program requires the following code:

if (C1. Checked)
{
}
if (C2. Checked)
{
}
....
if (C10. Checked)
{
}

But if you use the CheckBoxList component in your program, you just need the following lines of code:

for (int i = 0; I/CHK. Items. Count; i++)
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.