S
shapper
Hello,
I am trying to create a gallery (n columns by m rows) of images.
I am having a few problems on the steps.
From a List<Product> I am doing the following:
1. Determine the number of rows needed. I am using:
Int32 rows = (Int32)Math.Ceiling(products.Count() / (Double)
(columns == 0 ? 1 : columns));
I think it is ok ...
2. Loop through all products and create the rows and columns. For
example:
If I have 10 records and 4 columns I will have 3 rows.
Then I will need to loop through all products doing as follows:
Create row 1:
Create columns 1,2,3,4 with Product 1,2,3,4
Create row 2
Create columns 1,2,3,4 with Product 5,6,7,8
Create row 3:
Create columns 1,2 with Products 9,10 and create columns 3,4
with String.Empty.
My problem is to create this loop and using the List<Product>.
I will need some kind of index ... I think. I am not sure I can do
this with a List.
How can I do this?
Thanks,
Miguel
I am trying to create a gallery (n columns by m rows) of images.
I am having a few problems on the steps.
From a List<Product> I am doing the following:
1. Determine the number of rows needed. I am using:
Int32 rows = (Int32)Math.Ceiling(products.Count() / (Double)
(columns == 0 ? 1 : columns));
I think it is ok ...
2. Loop through all products and create the rows and columns. For
example:
If I have 10 records and 4 columns I will have 3 rows.
Then I will need to loop through all products doing as follows:
Create row 1:
Create columns 1,2,3,4 with Product 1,2,3,4
Create row 2
Create columns 1,2,3,4 with Product 5,6,7,8
Create row 3:
Create columns 1,2 with Products 9,10 and create columns 3,4
with String.Empty.
My problem is to create this loop and using the List<Product>.
I will need some kind of index ... I think. I am not sure I can do
this with a List.
How can I do this?
Thanks,
Miguel