Click here to Skip to main content
16,020,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to bind alternate css in listview in asp.net???

What I have tried:

CssClass='<%# If((Eval(Container.DisplayIndex + 1).ToString() Mod 2) = 0, "acc1", "acc2")%>'
Posted
Updated 19-Jul-16 19:39pm

1 solution

try this

VB
class="<%# If(Container.DisplayIndex Mod 2 = 0, "acc1", "acc2") %>"

or
VB
class='acc<%# (Container.DataItemIndex Mod 2)+1 %>'>
 
Share this answer
 
Comments
kaushik ahir 20-Jul-16 4:09am    
Thanks
Karthik_Mahalingam 20-Jul-16 9:03am    
welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900