Image control does not refresh

S

Sunit Joshi

Hello All

I have an image control in main.aspx in a method

BuildImage()
{
//...code..
imgDisks.ImageUrl = "barChart.aspx";

}

This is called whenever the user Clicks on Submit button:

In barChart.aspx I do:
private void Page_Load(object sender, System.EventArgs e)
{
Chart chart = getChart();
Bitmap bitmap = new Bitmap(chart.Width, chart.Height,
PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap);
chart.draw(g);

MemoryStream stream = new MemoryStream();
bitmap.Save(stream, ImageFormat.Png);

Response.Clear();
Response.ContentType = "image/png";
Response.BinaryWrite(stream.ToArray());
g.Dispose();
}

However I still have to sometimes click on submit twice to get the new
image. Any pointers on what might be happening are greatly
appreciated.

thanks
Sunit
(e-mail address removed)
 
S

Suresh

It's possible that your page is being loaded from the
cache on the browser.
Try adding junk(random) to the URL and see if that helps.
(i.e. mypage.asps?junk=1340891234809)

HTH,
Suresh.
 

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,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top