Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

asp:repeater

Posted on 2004-10-13
3
Medium Priority
?
843 Views
Last Modified: 2008-02-26
hi.

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?

thx. bg
0
Comment
Question by:BeerGod
3 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 800 total points
ID: 12305356
Hi BeerGod,

you can use datagrid, repeater or datalist - everything depends on the purpose
all of these controls has an event ItemDataBound (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIWebControlsDataListClassItemDataBoundTopic.asp) which is fired before the current row of the control is shown
so if you use this event  ( and the example of the given url ) you can pass a value from your datarow to the user control

Regards!
B..M
0
 
LVL 2

Expert Comment

by:raed_hasan
ID: 12310736
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?
0
 

Author Comment

by:BeerGod
ID: 12313970
thx. that was easy.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question