Accessing DataItems of other DataListItems from the ItemDataBound event

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
N

Nathan Sokalski

I am trying to access the DataItem of other DataListItems in a DataList of
mine from within the ItemDataBound. The code I am currently using is:

CStr(CType(Me.datMain.Items(e.Item.ItemIndex - 1).DataItem,
DataRowView).Row("id"))

However, this gives me an error stating that the object cannot be found.
What am I doing wrong? Thanks.
 
My guess is that the DataItem property is available only for the item that
fired the ItemDataBound event. There is no any connection between the
datalist items and their data items after the formers got bound.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
Back
Top