Image Render Page performing other tasks??

  • Thread starter Jeronimo Bertran
  • Start date
J

Jeronimo Bertran

I have an aspx page that shows a complex image with several objects that
are sensitive to mouseover events. The information about the objects in
the image is obtained from a database and complex calculations are
performed for each object to determine the position within the image. To
render the image I created an aspx page that uses the following code to
render the image:

Response.ContentType = "image/jpeg";
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);

For the mouseover I am using a usemap in the image, and I am calculating
each one of the map areas by constructing the map programatically:

<area onmouseover='functiontocall(" + count + ")' >


My problem is that I have the creation of the map areas in the main aspx
page and the rendering of the image on the rendering page. Currently I
have to go through the entire process of determining the position of each
object twice by going to the database and performing calculations....once
to create the map and another time to render the image. Is there a way to
do this in a single pass? For instance, to have the rendering page store
the map definition so that the parent page can use it???

Thanks!!

Jeronimo
 
S

Steve C. Orr [MVP, MCSD]

It sounds like you have an interesting project.
You should be able to use Session state for such a thing.
 
J

Jeronimo Bertran

Steve,

I am trying to use the session state to save the map area information when
I render the image... however I am having problem accessing the value of
the session state on the parent page because it is always being executed
before the rendering takes place and thus the session state variable is not
yet set.... here is what I did:


In the parent page I created the following:

In the html I have:

<img src="Render.aspx" usemap="#ImagePoints"> <%TestVariable();%>

TestVariable is defined as

public void TestVariable()
{
string str = (string) Session["MapAreas"];
}


Now, in Render.aspx, inside the Page_Load I have the following:

Session["MapAreas"] = "hello there";

The problem I have is that the TestVariable code is executed before the
Page_Load for the Render.aspx.

Thanks again,

Jeronimo
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top