Repeater DataItems is null

G

Guest

Hello.
Trying to bind data from a Repeater and ITemplate, but everytime I bind the
senders dataitem is null.

I've an:
public void InstantiateIn(Control container)
{
Table t = new Table();
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TextBox l = new TextBox();
l.DataBinding += new EventHandler(tc_DataBinding);
tc.Controls.Add(l);
tr.Cells.Add(tc);
t.Rows.Add(tr);

container.Controls.Add(t);
}
void tc_DataBinding(object sender, EventArgs e)
{
TextBox tc = (TextBox)sender;
RepeaterItem container = (RepeaterItem)tc.NamingContainer;
tc.Text = ((DataRowView) container.DataItem)["CustomerID"].ToString();

}

But the RepeaterItem is empty :-(

Can somebody try to explain me why? Im a bit confused?:?:?

Kind regards
 
G

Guest

Never mind :)

I found out all by myself... Apparantly the DataItem only works the
ItemTemplate and not the HeaderTemplate.

Have a nice day....
 

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

Top