Asp. NET WebForm Component CheckBoxList programming (3)

Source: Internet
Author: User
Four Example describes how to use the CheckBoxList component:

(1). How to determine which check boxes are selected in the component:

In a program, it is done by handling the selected property and the Count property, as follows:

for (int i = 0; I chklist. Items. Count; i++)
{
if (chklist. Items [i]. Selected)
{
Lblresult. Text + chklist. Items [i]. Text + "<BR >";
}
}

(2). How to set the appearance layout of the CheckBoxList component:

CheckBoxList component has more properties to set its appearance, in the program described in this article, mainly through four aspects to set the appearance of the component layout: the check box in the component of the text and selection of the box placement, components in the layout of the check box, The alignment of each check box in the component and the number of rows in each check box in the component, as follows:

The placement of text and Marquee in the check box in the component
Switch (cboalign. SelectedIndex)
{
Case 0:
Chklist. TextAlign = TextAlign. Left;
break;
Case 1:
Chklist. TextAlign = TextAlign. right;
break;
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.