[go: up one dir, main page]

0% found this document useful (0 votes)
11 views17 pages

Web Controls

The document discusses various web controls, specifically focusing on list controls such as ListBox, DropDownList, CheckBoxList, and RadioButtonList, along with their properties. It also provides an example of using CheckBoxList to display selectable options and a command button to list selected options. Additionally, it covers the creation of dynamic table controls with specified rows and columns, including code snippets for configuring table appearance and handling button clicks.

Uploaded by

REHMAN ASHRAF
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views17 pages

Web Controls

The document discusses various web controls, specifically focusing on list controls such as ListBox, DropDownList, CheckBoxList, and RadioButtonList, along with their properties. It also provides an example of using CheckBoxList to display selectable options and a command button to list selected options. Additionally, it covers the creation of dynamic table controls with specified rows and columns, including code snippets for configuring table appearance and handling button clicks.

Uploaded by

REHMAN ASHRAF
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

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=ListSelectionMode.Multiple

• 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.

tbl.BorderStyle = BorderStyle.Inset
tbl.BorderWidth = Unit.Pixel(1)

16
cmdCreate.Click
tbl.Controls.Clear()
Dim i, j As Integer
For i = 0 To Val(txtRows.Text - 1)

Dim rowNew As New TableRow()


tbl.Controls.Add(rowNew)
For j = 0 To Val(txtCols.Text - 1)

Dim cellNew As New TableCell()


Dim lblNew As New Label()
lblNew.Text = "Example Cell (" & i.ToString() & "," & j.ToString() & ")<br>"
Dim imgNew As New System.Web.UI.WebControls.Image()
imgNew.ImageUrl = "cellpic.png"
cellNew.Controls.Add(lblNew)
cellNew.Controls.Add(imgNew)

If chkBorder.Checked = True Then


cellNew.BorderStyle = BorderStyle.Inset
cellNew.BorderWidth = Unit.Pixel(1)
End If

rowNew.Controls.Add(cellNew)
Next
Next

17

You might also like