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 60 | Next

Joydip Kanjilal

"ASP.NET Data Presentation Controls Essentials"

In the Click event of the
BulletedList control, write the following code to retrieve the text of the selected list
item in the control.
protected void bListDept_Click(object sender, BulletedListEventArgs
e)
{
Label1.Text = "You have clicked: "+bListDept.Items[e.Index].Text;
}
Chapter 2
[ 57 ]
Removing List Items from the BulletedList Control
To remove a specific list item from the list item collection of the ???ulletedList control, BulletedList control,
use the RemoveAt() method of the Items collection property of the control, as shown
in the following code snippet:
BulletedList1.Items.RemoveAt(0);
To remove all the list items from the BulletedList control, use the following code:
BulletedList1.Items.Clear();
Here, BulletedList1 is the name of the BulletedList control.
Binding Data to the BulletedList Control
Like the earlier list controls, you can bind data to the BulletedList control in either of
the following ways:
Declarative
Programmatic
We have already seen how we can bind static data to this control declaratively
through the .aspx file. This section discusses how you can bind data to this control
programmatically.
You can bind data to the BulletedList control using a valid data source and the
DataBind() method. Like the other list controls that we have already discussed, you
need to specify the DataTextField and the DataValueField properties to specify
the Text and Value properties of each of the list items in the control.


Pages:
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6