ListBox Control
The ListBox control is used to create a multi-select list box, and options are defined by the ListItem element.
Common Properties of a ListBox control:
1.Count: Indicates the total number of entries in the list box.
2.Items: Represents all items in a list box, and the type of each item is ListItem.
3.Rows: Indicates the number of rows displayed in the list box.
4.Selected: Indicates whether an entry is selected.
5.SelectedIndex: The index value of the selected item in the list box.
6.SelectedItem: Gets the selected entry in the list box, and the returned type is ListItem.
7.SelectionMode: The selection type of the entry, which can be multi-select (multiple) or single.
8.SelectedValue: Gets the selected value in the list box.
common methods for ListBox controls:
1.ClearSelected: Deselect all items in the ListBox.
2.GetItemHeight: Gets The height of an item in the ListBox.
3.GetItemRectangle: Gets The bounding rectangle of an item in the ListBox.
4.GetSelected: Returns a value that indicates whether the specified item is selected.
5.Sort: sorts the items in the ListBox.
DropDownList Controls
The DropDownList control provides a drop-down list box that can be selected by the user, similar to a ListBox control, except that it displays the selected item and drop-down button in the box, and the list of options is displayed when the user clicks the drop-down button.
Common Properties and methods for DropDownList controls:
1.Items: Gets the collection of list control items, and the type of each item is ListItem.
2.Selected: Indicates whether an entry is selected.
3..SelectedIndex: Gets or sets the index value of the selected item in the list box.
4.SelectedItem: Gets the selected item with the smallest index in the list box, and the return type is ListItem.
5.SelectedValue: Gets the selected value in the list box.
6.ClearSelection Method: Clears the list selection and sets the Selected property of all items to false.
CheckBoxList Controls
the CheckBoxList control is used to create multiple selection check box groups that can be created dynamically by binding controls to a data source.
properties and events commonly used by CheckBoxList controls:
1.AutoPostBack: Gets or sets a value that indicates whether the postback to the server is automatically generated when the user changes the selection in the list.
2.CellPadding: Gets or sets the distance (in pixels) between the border of the table cell and the content.
3.DataSource? : Gets or sets the object that the data-bound control retrieves a list of its data items from.
4.DataTextField: Gets or sets the data source field that provides the text content for the list item.
5.DataValueField? : Gets or sets the data source field that provides values for each list item.
RadioButtonList Controls
The RadioButtonList control provides a set of radio buttons for Web page developers that can be dynamically generated by binding.
Common Properties and methods for RadioButtonList controls:
1.RepeatColumns: Gets or sets the number of columns to display in the control.
2.RepeatDirection: Gets or sets a value that indicates whether the control is displayed vertically or horizontally.
3.RepeatLayout: Gets or sets the layout of radio buttons within the group.
4.SelectedIndex: Gets or sets the lowest ordinal index of the selected item in the list.
5.SelectedItem? : Gets the selected item with the smallest index in the list control.
6.SelectedValue: Gets the value of the selected item in the list control, or selects the item with the specified value in the list control.
7.SelectedIndexChanged event ? : Occurs when the selected item of a list control changes between information and the server.
8.DataBinding: Occurs when a server control is bound to a data source.
BulletedList Controls
The BulletedList control is used to create a bulleted list of items that can be dynamically generated using data binding.
Common Properties and methods for RadioButtonList controls:
1.BulletStyle : Gets or sets the bullet style of the BulletedList control.
2.ClearSelection : Clears the list selection and sets the Selected property of all items to false.
Table Control
Table controls can create programmable tables, and TableRow and TableCell provide a way for the table control to display the actual content. The advantage of using table controls to create tables is that programmers can easily create and manipulate tables using server code, making table creation more dynamic and conducive to programmer control of tables.
Table Control Object Model
The table control provides three classes:TableClassTableRowClasses andTableCellClass.Tableclass defines theThe table control acts as the parent control for the tables control. class provides a" rowtablerow class provides named celltablecell class. In a table control, the hierarchy of its objects is this: first, the Table object (). The contents of the table to be displayed are contained in object.
To add a table control to a page
Adding a Table control to a page can be divided into two steps:
1. Add a table.
2. add rows and cells.
Dynamic action Table controls
In ASP. , the most important feature of a table control is its programmability, which can be programmed to manipulate the table control according to the classes provided by the. NET Framework. To insert a row into a table control, you can add an object of the TableRow class to the rows property of the table control, and to add a cell, the TableRow The TableCell object can be added to the Cell property of the
The basic Web control two