Solved

asp:repeater

Posted on 2004-10-13
3
840 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

624 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