Solved

Finding a repeater item by index?

Posted on 2010-08-19
1
289 Views
Last Modified: 2012-08-13
I have the following repeater:


<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemDataBound="Repeater_ItemDataBound" >
    <HeaderTemplate>
      <ul id="navbar">
    </HeaderTemplate>
    <ItemTemplate>
      <li><span>
          <asp:ImageButton ID="imgButton" ImageUrl='<%# Bind("Image") %>' runat="server" PostBackUrl='<%# Bind("Path") %>'
            AlternateText='<%# Bind("AltText") %>' CssClass='<%# Bind("Clicked") %>' /></span>
      </li>
    </ItemTemplate>
    <FooterTemplate>
      </ul>
    </FooterTemplate>
</asp:Repeater>

In the Repeater_ItemDataBound is it possible to get a previously bound item by index?

For example say that I was binding the 5th item in the repeater, is it possible to get access to the first item so that I can change the imagebuttons style sheet?

Thanks
0
Comment
Question by:directxBOB
1 Comment
 
LVL 16

Accepted Solution

by:
Kamal Khaleefa earned 500 total points
ID: 33473888
you can assign a style sheet by the following

  e.Row.Attributes("onMouseOver") = "this.className='RSHover'"
            If e.Row.RowIndex Mod 2 = 0 Then
                e.Row.Attributes("onMouseOut") = "this.className='GridRowStyle'"
            Else
                e.Row.Attributes("onMouseOut") = "this.className='GridAlternatingRowStyle'"
            End If

 
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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.…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

13 Experts available now in Live!

Get 1:1 Help Now