asp.net.ph

DataList.ItemDataBound Event

System.Web.UI.WebControls Namespace   DataList Class


Occurs after an item in the DataList is data-bound but before it is rendered on the page.

[ VB ]
Public Event ItemDataBound As DataListItemEventHandler

[ C# ]
public event DataListItemEventHandler ItemDataBound;

[ C++ ]
public: __event DataListItemEventHandler* ItemDataBound;

In [ JScript ], you can handle the events defined by a class, but you cannot define your own.

Remarks

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

This event provides an opportunity to access each item ( or row ) 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 event is raised for the header, the footer, separators, and items.

Event Data

Information related to the ItemDataBound event is passed via a DataListItemEventArgs object to the method assigned to handle the event. The following DataListItemEventArgs property provides information specific to this event.

Property Description
Item Gets the DataListItem associated with the event.

Example

The below snippet shows how to attach a handler for the ItemDataBound event.

<asp:datalist id = "myDataList" runat = "server" onItemDataBound = "doWhatever" ... >

The following examples demonstrate how to code a handler for the ItemDataBound event of a DataList control in different scenarios.

DataList ItemDataBound Event
Run Sample | View Source
Basic Nested Templated Controls Example
Run Sample | View Source
Using a DropDownList in an Editable DataList
Run Sample | View Source
See Also

DataList Members   ItemCreated   DataListItemEventHandler Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph