Repeater Control Question

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
 
S

Scott Allen

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?
 

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