DataList ItemDataBound Event Example


Select Country:
State:
City:

The ItemDataBound event is raised whenever an item in the DataList control is bound to data.

This event provides an opportunity to access each item before the page is finally sent to the client for display. After this event is raised, the data item is nulled out and no longer available.

This example illustrates a way to handle the ItemDataBound event of a DataList.

The sidebar on the right panel contains a DataList control that is used to display a selection of hotels.

In this case, the ItemDataBound event handler is used to accomplish the following:

  • obtain and set the ImageUrl, NavigateUrl, ToolTip and Attributes properties for the hotel image hyperlink;
  • obtain and set the Text, NavigateUrl, ToolTip and Attributes properties for the hotel name hyperlink;
  • obtain and set the ImageUrl, NavigateUrl, ToolTip and Attributes properties for the rating image hyperlink;
  • compute and set the average nightly rate.

 

 

View Source   Exit

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.



Properties in
ANDALUSIA
Days Inn Andalusia
1604 Dr. MLK Jr. Expresssway, Highway 84E
ANDALUSIA

Average Nightly Rate: $66.85