DDL Image runs slow, need suggestion on optimization

B

Beemer Biker

I have a 10 row (per page) gridview where the first column is a small image
under 100x200px and the second column is a DropDownList template that
selects which image to show in the first column. This works, but I noticed
that when I click the DDL and select another image, all the images on the
page get refreshed. There are as few as 3 images and not more than 7 per
row. Worst case would be 7x10 = 70 small images that need to be loaded.
Ideally they should be loaded only once when the page is first displayed.

I was wondering how I can speed this up so that there is no need to post
back to the server to get the image. The images are not static, they are
calculated, but during page load (or data bind) I know how many images there
are at max and how to calculate them. I was wondering if I could store them
somewhere on the page but only display the image that corresponds to the
index of the DDL in the second column. I do not know how to do that.

Scrolling the first column would also work, but how do I concatenate 3 to 7
images together? Currently, if the user clicks on the small image I launch
the full size image into a new window or IE7 tab. I would still need that
functionality.

Alternately, a real DDL image combo box would be nice, but I didnt see how
to put one together in the first place so I came up with my current scheme
of using two columns.

...TIA..


--
=======================================================================
Beemer Biker joestateson at grandecom dot net
http://TipsForTheComputingImpaired.com
http://ResearchRiders.org Ask about my 99'R1100RT
=======================================================================
 
B

bruce barker \(sqlwork.com\)

switch to client script. any javascript book will tell you how to do this.

-- bruce (sqlwork.com)
 
B

Beemer Biker

bruce barker (sqlwork.com) said:
switch to client script. any javascript book will tell you how to do this.

-- bruce (sqlwork.com)

Thanks bruce, yes, I did get it into jscript and it works much better. I
replaced the two columns in my grid (image and ddl) with a single column
that was a template and added htmlimages to the panel I had put on it. It
still takes a while for all the images to load, but I am going to make
"thumbs" of the images and not have them created on the fly.

// pngString = "python script produces small png for each
channel(i)"
HtmlImage thisSpectrum = new HtmlImage();
thisSpectrum.Style.Add(HtmlTextWriterStyle.BorderStyle,
"solid");
thisSpectrum.Style.Add(HtmlTextWriterStyle.BorderWidth,
"1px");
thisSpectrum.Attributes.Add("title", "Channel " + (1+i));
thisSpectrum.Attributes.Add("onclick", "return
SpectrumImages_onclick('" + pngString + "&plotwidth=800&plotheight=600')");
thisPanel.Controls.Add(thisSpectrum);

The above gave me a nice horizontal scrolling panel of spectrum images, each
image could be clicked on to get a larger image in another window or tab.
This worked much better as there was no post back.


--
=======================================================================
Beemer Biker joestateson at grandecom dot net
http://TipsForTheComputingImpaired.com
http://ResearchRiders.org Ask about my 99'R1100RT
=======================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top