I have a list of objects which need to be output 2 items per row, and with each alternate row to have a different background (using different CSS classes).
Currently, I’m using a DataList, binding the list to it, RepeatColumns=2, RepeatDirection=’horizontal’. ItemStyle and AlternatingItemStyle are being used to style the two columns. This results in the right layout but I can’t figure out how to apply a different styling per row.
I am open to using any other controls to get the job done. There must be a way to achieve this without writing out the HTML manually:
One option is the repeater control. Much more flexible, but the trade off is that you have to build the templates for it yourself.
See http://msdn.microsoft.com/en-us/magazine/cc163780.aspx