SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 39 | Next

Joydip Kanjilal

"ASP.NET Data Presentation Controls Essentials"

We will discuss how we can add,
remove, and select list items for these controls.
Working with the ListBox Control
The ListBox control, a container of list items, can be used to create and display a list
of items and select one or multiple items from such list of items. However, you can
control the number of list items displayed in the control, and adjust the size of the
control, that is, height and width.
In order to work with a ListBox control, simply drag-and-drop an instance of the
control from the toolbox into your web form.
Appending List Items to the ListBox Control
You populate data in a ListBox control using the list items. You can add the list
items through the .aspx page as shown in the following code snippet:
Width="214px">
Joydip
Douglas
Jini
Piku
Rama
Amal
Indronil

??? ??? ??? ??? ???
Chapter 2
[ 37 ]
You can also add list items to the ListBox control programmatically using the
overloaded Add() method of the Items property of this control as shown in the
following code snippet:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateListItems();
}
private void PopulateListItems()
{
ListBox1.


Pages:
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6