Author |
Topic  |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 27 November 2003 : 03:09:41
|
OK, I'm still at the clueless newbie stage, but I'm progressing. My .Net knowledge still consists of trying out code snippets until something works, but I'm moving pretty well.
I have been playing with some 4guys code at http://aspnet.4guysfromrolla.com/articles/011503-1.2.aspx but alarmingly I've just realised something .... let's say there are 9 images, the code (and other examples I've got) display in this fashion :
1 4 7 2 5 8 3 6 9
now what I REALLY need is :
1 2 3 4 5 6 7 8 9
Is there a way (hopefully easy) to make this happen ? |
|
Nathan
Help Moderator
    
USA
7664 Posts |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 27 November 2003 : 05:06:08
|
Thanks Nathan 
Any good .Net books you can recommend ? |
 |
|
DavidRhodes
Senior Member
   
United Kingdom
1222 Posts |
Posted - 27 November 2003 : 05:10:44
|
Use a DataTable (like a Recordset) to store the images, then you will have to bind the DataTable to a DataList with RepeatColumns set to 3 and use RepeatDirection as Nathan said. You could also store the DataTable in the Cache object so that you don't have to re-populate it all the time! |
The UK MkIVs Forum |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 27 November 2003 : 05:15:27
|
The property Nathan mentioned does the job great, but if I want to do paging (e.g. 34 images in a folder, but I want to see 10/page = 4 pages) would a DataTable or anything else be better for that ?
Sorry for the dumb questions, I have a bit of OOP experience in other languages, and I'm trying to learn .Net (the VB form) |
 |
|
DavidRhodes
Senior Member
   
United Kingdom
1222 Posts |
Posted - 27 November 2003 : 05:53:54
|
Not sure if the DataList has built in paging but you could get around it easily using a similar concept to ASP paging. Get the DataTable.Rows.Count Loop the DataTable.Rows until <= 10 Show next page link if DataTable.Rows.Count > 10 Start the loop on the next page at 11 in DataTable.Rows and so on..... 
Store the DataTable in the Session or Cache so it doesn't need to be re-populated on each page, you could actually store it in ViewState but be careful of the page size |
The UK MkIVs Forum |
Edited by - DavidRhodes on 27 November 2003 05:55:48 |
 |
|
Nathan
Help Moderator
    
USA
7664 Posts |
Posted - 27 November 2003 : 05:59:33
|
I would keep the page number in the query string and try to only grab the minimum I needed for that page. Be it records from a database or objects from the file system. Just too keep memory usage as trim as possible. |
Nathan Bales CoreBoard | Active Users Download |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 27 November 2003 : 06:00:59
|
no probs, paging is simple to write, but even better if it's built in. |
 |
|
|
Topic  |
|