Solved

asp:repeater

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now