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