Question on Repeater DataItem

  • Thread starter Thread starter jw56578
  • Start date Start date
J

jw56578

What is the explanation for the following.
if i do:

reapeter1.datasource = somedatasource
repeater1.databind()

foreach(RepeaterItem ri in repeater1.Items)
{
object o = ri.DataItem;
}

but DataItem is always null, even though it binds and displays properly
 
DataItem is there only for the item-creation process, that is ItemCreated
and ItemDataBound methods (ItemCreated when it happens due to call to
DataBind). After ItemDataBound has run of for the item in question, DataItem
is explicitly set to null.
 

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

Back
Top