you can use The AdRotator Web server control in asp.net to Display images
The AdRotator control reads advertisement information from a data source, which contains one or more ad records. You can store ad information in a database table with a specific schema, and then use a data source control to read the ad records at run time.
If you have an existing table with ad information, you can map the schema of your table to the fields that are required by the AdRotator control.
a simple solution would be to store all consumed image ids in a hiddenfield...then next time when you make a sql call send these ids...in sql write a where clause with NOT IN (these ids...) with TOP 1, that will give you uniqueness
ibocus
Member
23 Points
77 Posts
Random Images in an Image Control
Sep 20, 2012 06:07 AM|LINK
an asp.net program that displays random images in an image control using select case statement?
can anyone help me out of this.
thanks in advance
sandippatil4...
Participant
1659 Points
315 Posts
Re: Random Images in an Image Control
Sep 20, 2012 07:14 AM|LINK
Hi,
you can use The AdRotator Web server control in asp.net to Display images
The AdRotator control reads advertisement information from a data source, which contains one or more ad records. You can store ad information in a database table with a specific schema, and then use a data source control to read the ad records at run time. If you have an existing table with ad information, you can map the schema of your table to the fields that are required by the AdRotator control.
see below links
http://msdn.microsoft.com/en-us/library/ms227550(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/edx4dac3(v=vs.100).aspx
geniusvishal
Star
13984 Points
2783 Posts
Re: Random Images in an Image Control
Sep 20, 2012 07:26 AM|LINK
Try:
Select Top [NumberofImagetoDisplay] * From photos order by newid()
Image1.ImageUrl = [path from above query]
Refer:
http://www.petefreitag.com/item/466.cfm
http://stackoverflow.com/questions/1173703/whats-the-best-way-to-show-a-random-image-in-asp-net
My Website
www.dotnetvishal.com
ramiramilu
All-Star
95275 Points
14072 Posts
Re: Random Images in an Image Control
Sep 21, 2012 02:04 PM|LINK
a simple solution would be to store all consumed image ids in a hiddenfield...then next time when you make a sql call send these ids...in sql write a where clause with NOT IN (these ids...) with TOP 1, that will give you uniqueness
and to get randomness use this script - http://blog.sqlauthority.com/2007/04/29/sql-server-random-number-generator-script-sql-query/ , get the random number and check if it is in supplied consumed IDs...if no, then make TOP 1 as mentioned above..
Thanks,
JumpStart