Problem with DataList's ItemDataBound Event

N

Nathan Sokalski

I have a DataList control that I use the ItemDataBound event for. One of the
properties of the DataList that I use in this event is
Me.datMain.Items.Count (datMain is the id of my DataList) in order to
determine whether the current DataListItem is the last one. However, the
Me.datMain.Items.Count property changes with each calling of the
ItemDataBound event (for the first item it is 0, for the second it is 1, for
the third it is 2, etc.). Therefore, it does not help me determine whether I
am at the last DataListItem. Does anybody know a good simple way to
determine how many DataListItems will be added? Thanks.
 
M

Masudur

I have a DataList control that I use the ItemDataBound event for. One of the
properties of the DataList that I use in this event is
Me.datMain.Items.Count (datMain is the id of my DataList) in order to
determine whether the current DataListItem is the last one. However, the
Me.datMain.Items.Count property changes with each calling of the
ItemDataBound event (for the first item it is 0, for the second it is 1, for
the third it is 2, etc.). Therefore, it does not help me determine whether I
am at the last DataListItem. Does anybody know a good simple way to
determine how many DataListItems will be added? Thanks.

Hi,

why dont you actually compare the datasourse's item count...
you must be binging the datalist with a datatable or a bindable
objectcollection
just get the count property of the datasourse and then use it to
server for your purpose...

Thanks
Masudur
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top