Container

M

Mike Chamberlain

Can someone explain what the Container object is, and how it it related
to data binding? I can't find any reference for it anywhere.

Mike
 
B

Brock Allen

When you write DataBinding syntax a method is created that gets called for
every row that will be created for your databinding control. Container is
a local variable in that method which is a reference to the row in the control
that was just created. DataItem is typically the property on the row object
that references the row from the original data source that the row is built
from.

A great way to understand what's going on is to do this:

<ItemTemplate><%# Container.DataItem.GetType().FullName %></ItemTemplate>

This will emit the type of object Container is. For different data bound
controls you'll see different output. Once you know the Container type, then
go look up in the docs about it.
 

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,951
Messages
2,570,113
Members
46,698
Latest member
alexxx

Latest Threads

Top