Repeater Control Question

  • Thread starter Thread starter Raed Sawalha
  • Start date Start date
R

Raed Sawalha

Hello:

i have a UserControl i created. for datarow in my dataset i want to display
one of these controls on my page. do i want to use a repeater control to do
this? how do i pass a datarow to each of the user controls created?


Regards
 
Hi Raed:

Inside the ItemTemplate for the Repeater you can add the markup for
your user control.

<ItemTemplate>
<uc:MyControl runat="server" id="MyControl1"/>
</ItemTemplate>

Catch the Repeater's data binding event to manipulate your user
control in each row:

protected void Repeater1_ItemDataBound(
object sender,
RepeaterItemEventArgs e
)
{
// get the control
MyControl c = e.Item.FincControl("MyControl1");

// get the data container
object o = e.Item.DataItem;

// get o into c

}

Makeing some sense?
 
Back
Top