views:

287

answers:

1

I have a jquery Image slider in a content page that worked fine. Once I converted it into a asp repeater the first image of the repeater would display twice, then run normally.

Any idea on why the repeater is causing this?

I think I discovered that the first image link

<ItemTemplate>
 <a href='<%#Eval("Url")%>'>
 <img src='<%#Eval("Image")%>' alt="Spring Break 2011"
  rel='<h3><%#Eval("Title")%></h3><%#Eval("Caption")%>'/></a>
</ItemTemplate>

I have to place class="show" in the first item only. Does anyone know how to implement this during the first time it goes through. Hmm

+1  A: 

Something like this should work for you:

<ItemTemplate>
 <a href='<%#Eval("Url")%>' <%# Container.ItemIndex == 0 ? "class='show'" : "" %> >
 <img src='<%#Eval("Image")%>' alt="Spring Break 2011"
  rel='<h3><%#Eval("Title")%></h3><%#Eval("Caption")%>'/></a>
</ItemTemplate>

Reference the Container.ItemIndex property for the item being databound to the repeater and if it is 0 (i.e. item 1), output a class attribute.

kristian
You are..AWESOME..mad kudos to you kristian
Bry4n