Hi Dave,
As for the adding dynamic created controls into repeater rows depending on
the databound values, I think the "ItemDataBound" event is the one you're
looking for. we can dynamically create controls there and add them into
repeater row. Also, the event's parameter can let us check the current
databinding datarow's value do do some conditional customization. Here is a
simple example:
==========repeater template===
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"
OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate >
<hr style="width:100%" /><br />
</ItemTemplate>
</asp:Repeater>
======================
==========code behind=========
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
string name = DataBinder.Eval(e.Item.DataItem,
"CategoryName","{0}");
if (e.Item.ItemIndex % 2 == 1)
{
TextBox txt = new TextBox();
txt.Text = name;
e.Item.Controls.Add(txt);
}else{
Label lbl = new Label();
lbl.Text = name;
e.Item.Controls.Add(lbl);
}
}
}
================================
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================