Problem with DataList's ItemDataBound Event

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
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.
 
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
 
Back
Top