views:

444

answers:

1

I have a list of data that I need to display in a web page 3 at a time

The first needs to be displayed in a div called "left" , the second in a div called "centre" and the third in a div called "right".

And I need to be able to scroll through the data with a pager. And so the next 3 results will be displayed in a similar way, and so on till the end of the data set

Obviously the alternating templates in the repeater are not suitable for this.

Is there a smarter way to achieve this?

A: 

Try a loop like this

for (int i = 3; i < enumerable.length + 3; i++) {

  if (i % 3 == 0)
  { 
     // Put it in div 1
  {
  else if (i % 3 == 1)
  {
     // put it in div 2
  {
  else if (i % 3 == 2)
  {
     // put it in div 3
  {

}

The first time through, it will use div1, the second time div2, and the third time div3, and then the fourth time div1, and so on...

cerhart