ListView (the server-side control), like all repeating data controls in ASP.NET, has an AlternatingItemTemplate , but it would be a shame to have to copy all the markup in the ItemTemplate into AlternatingItemTemplate , just to alternate styles on the items. It's quite likely that only css classes will change between the two, and redundancy is bad <- big scoop here. But there is a simpler way. From within any template, you have access to the current index of the row within the whole data set, using Container.DataItemIndex , and within the currently displayed items, using Container.DisplayIndex . This gives us an easy way to alternate styles: < ItemTemplate > < li class =" <% # Container.DisplayIndex % 2 == 0 ? "even"...(read more)
Source Click Here.
A
New
Internet
Library: Add Your Website/Blog
or Suggest A Website/Blog to our Free Web Directory
http://anil.myfunda.net.
Its very simple, free and SEO Friendly. Submit Now....
Its very simple, free and SEO Friendly. Submit Now....
Friday, July 25, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Post your comments here: