Web Controls
Part II
List Controls
• ListBox
• DropDownList
• CheckBoxList
• RadioButtonList
• BulletedList (Not selectable)
• Properties of Selectable List Controls
– SelectedIndex
– SelectedItem
• Properties of ListItem
– Text
– Value
– Selected
2
Multiple Select List Controls
• ListBox
– SelectionMode=[Link]
• RadioButtonList
• DropDownList
• CheckBoxList
3
Example: Use of CheckBoxList
• Display a list of options with checkboxes.
• Display a command button.
• When the user clicks the command button the selected options are
listed in a separate control.
• Required Web Control Classes
– CheckBoxList
– Button
– Label
4
5
6
7
8
9
Table Controls
10
Example: Use of Table Controls
Create a table with x rows and y columns dynamically.
11
12
13
14
15
Page_Load
' Configure the table's appearance.
' This could also be performed in the .aspx file,
' or in the cmdCreate_Click event handler.
[Link] = [Link]
[Link] = [Link](1)
16
[Link]
[Link]()
Dim i, j As Integer
For i = 0 To Val([Link] - 1)
Dim rowNew As New TableRow()
[Link](rowNew)
For j = 0 To Val([Link] - 1)
Dim cellNew As New TableCell()
Dim lblNew As New Label()
[Link] = "Example Cell (" & [Link]() & "," & [Link]() & ")<br>"
Dim imgNew As New [Link]()
[Link] = "[Link]"
[Link](lblNew)
[Link](imgNew)
If [Link] = True Then
[Link] = [Link]
[Link] = [Link](1)
End If
[Link](cellNew)
Next
Next
17