Asp. NET WebForm Component CheckBoxList programming (2)
Source: Internet
Author: User
Asp.net|web| programming One. How to create a CheckBoxList component:
<asp:checkboxlist runat = "server" id = C1 >
<asp:listitem Value = 1 > first check box </asp:listitem >
<asp:listitem Value = 2 > second check box </asp:listitem >
<asp:listitem Value = 3 > Third check box </asp:listitem >
.....
Note: You can add a few check boxes here
</asp:checkboxlist >
By adding the above statement to the ASP.net page, you can produce a CheckBoxList component called "C1".
Two Properties that are frequently used in CheckBoxList components:
I. TextAlign property: The value is: left, right. If the value of the textalign is left, the text of the check box in the CheckBoxList component is on the left-hand side of the marquee, and similarly, if the TextAlign value is right the text of the check box is on the right-hand side of the marquee.
II. Selected property: Is a Boolean that determines whether the check box in the component is selected.
III. RepeatColumns property: There are several check boxes in the CheckBoxList component that basically set how many rows the check boxes are displayed in.
IV. RepeatDirection property: The value of this property can be: Vertical, horizontal. When the RepeatColumns property is set, set how this property arranges the individual check boxes in the component. Specifically as follows:
Suppose the CheckBoxList component has four check boxes, and the RepeatColumns property value is 2.
(1). If RepeatDirection = Vertical, the check box is displayed in the page as follows:
check box 01 check box 03
check box 02 check box 04
(2). If RepeatDirection = horizontal, the check box is displayed in the page as follows:
check box 01 check box 02
check box 03 check box 04
V. Count property: Returns how many check boxes are in the CheckBoxList component.
Three Methods that are frequently used in CheckBoxList components:
(1). Add a check box to the component, the syntax is as follows:
Chklist. Items. ADD (New ListItem ("text", value >))
(2). Access the check box in the component, the syntax is as follows:
Chklist. Items [Index >]
(3). Delete the check box in the component, the syntax is as follows:
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.