• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 685
  • Last Modified:

How to programatically access rows in a repeater control

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 vb.net. I do not know how to access rows in a repeater.

<div class="history">
        <ul>
            <asp:Repeater id="rptStatus" runat="server" OnItemCreated="rptStatus_ItemCreated">
              <ItemTemplate>
                 <li>
                 
                     <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>  
                     
                     <div class="bottom">
                        <asp:Label ID="lblHistoryDate" CssClass="date" Text='<%#Eval("HistoryDateTime", "{0:d}")%>'
                                       runat="server">
                        </asp:Label>
                     </div>
                                         
                  </li>                    
              </ItemTemplate>              
            </asp:Repeater>
        </ul>
    </div>
0
sergeiweerasuriya
Asked:
sergeiweerasuriya
  • 2
2 Solutions
 
sm394Commented:
0
 
sm394Commented:
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();

}
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now