Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CSS
Situation:

I am creating a website of products, where users will be able to browse by category.

The categories and descriptions and image URL's are stored in SQL Server files and will be on the page invisible in gridview tables.

Problem:

Since I don't know how many images are in the database, I need to create enough image containers to fit the database an allow the user to scroll to see all the images.

I know how to link the image URL's with the files, but need to know how to code the image containers as required on the fly.
Posted
Comments
GregWyatt 23-Jun-14 16:57pm    
Shane, I wouldn't try to create "enough" containers ahead of time. Instead you should have some sort of event trigger the loading of additional items as needed. Like Pages of results etc... Going along with the paging idea you can use a repeater control to load in the number of items on a page. That way you can have any given number of items on the page. If any of the above sounds promising to you, let me know and we can discuss it further.
Shane Mummery 25-Jun-14 7:49am    
Hi Greg, I'll take a look at that. I did manage to use the Gridview for the same effect.

Thank you.
GregWyatt 25-Jun-14 8:02am    
Just some tips about the Repeater control. I think its main benefit is that it lets you completely customize how each item in it looks without any additional HTML wrappings that other controls like DataList put around your items. The downside to both the DataList and Repeater control is that they don't inherently support paging. However, you can always make your own. If you don't want to do the paging idea or the Repeater control you could also just create the HTML and place it in a div with an id and runat server tag that would allow you to add to it from code behind. Then place a "Show More" button at the end of the div that they can click to load more items by appending the new HTML to the div.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900