Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading Images - loading image dialog for some images

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
Hi

We have a site that returns some images that are linked from other sites (ASP 2.0). We are using a repeater control to load the source url into the page which is fine for those that are static links.

However some require a serverside HTTP request and some processing, if I leave the user to wait for this processing we either get a timeout or just a long delay!

What would be the best method of returning the static images immediately and those requiring processing to be blank/loading image or similar whilst we are waiting for the processing?

Thanks
B
 
I agree with mark. create a js array of links to images. then make a request for each page in parallel. now all the images will load at the same time and appear to load faster.

in doing this you will be better of avoiding MS server controls and build the page from pure html as you will have control over tags/ids which is a big plus when dealing with ajax.

in a general overview the page would load with each image placeholder stating "loading image..." on page load (client, not server) make an ajax call to retrieve the image. on successful callback replace "loading image" with the actual image. on error callback load an "image not available" image you have on your server.

in the code behind load a string array with the links to the images and pass the array to the ScriptManager.RegisterClientScriptArray (or something like that) function. Also load a string array of ids for the image placeholder tags. in your client script
imagelink[0] would be the link to the image and imageplaceholder[0] would be the id of div/img tag to set the image scr.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top