Accessing DataItems of other DataListItems from the ItemDataBound event

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.
 
E

Eliyahu Goldin

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
 

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

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top