Solved

asp:repeater

Posted on 2004-10-13
3
836 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 200 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Login 17 50
Creating a route in asp.net webforms 2 25
imap mails 1 22
localhost: This site can’t be reached  localhost refused to connect. 2 47
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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