473,672 Members | 3,537 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image control does not refresh

Hello All

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

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

}

This is called whenever the user Clicks on Submit button:

In barChart.aspx I do:
private void Page_Load(objec t sender, System.EventArg s e)
{
Chart chart = getChart();
Bitmap bitmap = new Bitmap(chart.Wi dth, chart.Height,
PixelFormat.For mat32bppArgb);
Graphics g = Graphics.FromIm age(bitmap);
chart.draw(g);

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

Response.Clear( );
Response.Conten tType = "image/png";
Response.Binary Write(stream.To Array());
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
sj****@ingr.com
Nov 17 '05 #1
1 2018
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?jun k=1340891234809 )

HTH,
Suresh.
-----Original Message-----
Hello All

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

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

}

This is called whenever the user Clicks on Submit button:

In barChart.aspx I do:
private void Page_Load(objec t sender, System.EventArg s e)
{
Chart chart = getChart();
Bitmap bitmap = new Bitmap(chart.Wi dth, chart.Height, PixelFormat.For mat32bppArgb); Graphics g = Graphics.FromIm age(bitmap);
chart.draw(g);

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

Response.Clear( );
Response.Conten tType = "image/png";
Response.Binary Write(stream.To Array());
g.Dispose();
}

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

thanks
Sunit
sj****@ingr.co m
.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8783
by: Arnold | last post by:
Hey there, I've browsed for some fixes to this but only found a couple of similar posts, which didn't solve my problem. I'm wondering how to refresh an image control in a form after a user clicks a cmd button to open the Windows API Common Dialog and selects a new file (jpeg). Images are initially loaded in the form's oncurrent event. I've tried using me.dirty = false to make the form current. Has anyone experienced this before?
6
3475
by: Arnold | last post by:
Hi there, I've looked at numerous posts out there but have yet to find a solution to this. I have an image control on a main form that shows a linked jpeg thumbnail. Image controls are also on 2 subforms that also show linked thumbnails. When the user initially selects a jpeg from the Windows API Common Dialog Control, the image needs to immediately appear. I have the following code on the main form:
1
3299
by: Roberto Castro | last post by:
I have some problems with the way I am showing the BLOB fields in the Image web controls. It does work on my localhost though sometimes I need to hit Refresh for the images to load properly. However, when I try to access the same page from another machine or when I test the code on a remote server the images just wouldn't show. The page I am talking about has 3 Image web controls. In the CodeBehind I am loading these controls by using an...
2
2664
by: Rainer Sinsch | last post by:
Hello everyone, does anyone know, how I can refresh a webform image by pressing an asp.net-button? I have a statistics-jpg which gets updated every 5 minutes and want to provide a manual refresh button. My initial try was to simply do a post-back when pressing the button and adding <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
6
2514
by: Suraj Joneja | last post by:
Hi All, I've an image control on my ASP.net page. This displays an image named 'Logo.jpg' in the location '~\Images'. Another application can change this image. It can select any image and upload to the folder 'Images' and newly selected image would overwrite existing image 'Logo.jpg'. (Image name remains same and image changes). The image control on my page doesn't refresh the newly selected image. it displays the old image where as the...
1
3331
by: M West | last post by:
continuation of my previous post, thanks to all those that contributed with answers I am creating a control that will take an image and make parts of it transparent, this is done by creating and then applying a region to the control. The control inherits from picturebox and works fine when loading the image into the control, the problem that I am having now is, once the control is loaded and the image is displayed, if the user resizes...
5
2553
by: ramendra | last post by:
how to refresh a image control to pick up the latest image file on a asp.net page. i am generating a image based on the input from the user and displaying it on the page through image control. The problem is that i am not able to get the latest image on the page, it keeps showing the old page. But when i hit the refresh button on the toolbar it correctly gets the latest image and displays it in the control. But that has another problem, it...
0
1184
by: PeterKellner | last post by:
I have an asp.net 2.0 Image control that I have surrounded with the appropriate atlas:UpdatePanel tags. The Image control referencs an aspx page whose only job is to output an Image. (it forms the image in it's page_load and ultimately writes it to Response.OutputStream. In IE6, each time I cause a postback, the image is updated as I would expect. In firefox, the image does not get updated on postback until I force a refresh on the...
11
5661
by: Jerry J | last post by:
How can I get an asp:Image to refresh when a user uploads a different jpg. I disabled caching using this command on Page_Load(): Response.Cache.SetCacheability(HttpCacheability.No Cache); but it didn't help. The problem is that this page does not change images after a client uploads a new one. If I hit the browser's refresh, then I can see the updated image, but if I don't refresh, then I see the previous image.
32
3125
by: C. (http://symcbean.blogspot.com/) | last post by:
Hi all, I have an application which generates image graphs. These cache nicely at the client, however if the user submits more data, I'd like to force a reload of the image from the server. I had a google, but all I could find were suggestions to use a varying query in the URL. This is not a solution to my problem because if I change the page to do that then ALL the graphs will be reloaded every time.
0
8504
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8419
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8945
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8846
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8697
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2837
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2093
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.