How to programatically access rows in a repeater control

Posted on 2008-11-06
Last Modified: 2008-11-21
I have the following repeater control. What I nned to do is get all the HistoryDateTime field values from all the rows and put them in an array or a list so that I can do some processing in the code behind file. I use I do not know how to access rows in a repeater.

<div class="history">
            <asp:Repeater id="rptStatus" runat="server" OnItemCreated="rptStatus_ItemCreated">
                     <div class="top">
                         <asp:Label ID="lblStatus" CssClass="status" Text='<%#Eval("Status")%>' runat="server"></asp:Label>
                         <asp:Image ID="ImgArrow" CssClass="arrow" runat="server"  ImageUrl="~/Images/arrow.gif"/>
                     <div class="bottom">
                        <asp:Label ID="lblHistoryDate" CssClass="date" Text='<%#Eval("HistoryDateTime", "{0:d}")%>'
Question by:sergeiweerasuriya
    LVL 13

    Assisted Solution

    LVL 13

    Accepted Solution

    somthing like this on item databound

    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)

    DataRowView dv = e.Item.DataItem as DataRowView;
    string data = ((DataRowView)e.Item.DataItem).Row["ColName"].ToString();


    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Join & Write a Comment

    If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
    Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
    Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

    729 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

    20 Experts available now in Live!

    Get 1:1 Help Now