I have a problem with a web page that contains an imagebutton that displays a map generated by GDI commands and selected data from a gridview. The map is ‘live’ so that selecting a record in the gridview will highlight the point on the imagebutton, and vice versa. The map can also be zoomed and panned, so the image has to be constantly updated. The way I am doing this is to recreate the graphics, save the image as a bitmap file on the server and then reload it with ImageButton1.ImageUrl = "filename.bmp".
The problem is that while a new version of the image has been created and saved, it is not displayed – not unless I force a refresh. This generates the annoying msgbox “The page cannot be refreshed without resending the information…”. I presume this behaviour is due to caching, but other parts of the page are updated correctly without needing to refresh. For example a textbox can display the coordinates of the point clicked on the imagebutton. It seems to be only the image that is not updated.
So my questions are: 1. Is there a more direct way of updating the image on an imagebutton without having to save it to a file and then reload it? or 2. How can I force the latest version of the image to be retrieved from the server and displayed on the page? A solution of the first type would be preferable because that might also get around the problem of multiple visitors to the site generating multiple images.
I’m not sure if this is a “beginner” problem, but I am certainly a beginner when it comes to ASP.NET. Does anyone have any ideas?