IE 9的ImagePopup屏幕中显示的图像不正确 [英] Incorrect Image shown in ImagePopup screen on IE 9
问题描述
我面临在弹出屏幕上显示正确图像的问题.
在页面加载事件中,我以Base64String的形式从数据库获取图像.我将其转换为字节数组,然后在../temp/位置生成图像文件.之后,我为背景图像设置样式并传递网址../temp/image.JPG.
该代码对于IE8和其他浏览器正常工作,但在IE9上出现了问题.
发生问题时,请按照以下步骤操作.
步骤1:我点击图片1的预览按钮.
步骤2:我将id = 1传递给PopupImage屏幕.
步骤3:在页面加载中,根据id = 1
获取图像
步骤4:将显示正确的图像
步骤5:现在,我单击图像2的预览按钮.
步骤6:我将id = 2传递给PopupImage屏幕.
第7步:仍显示ID为1的图片
步骤8:刷新PopupImage屏幕,将显示正确的图像.您应该尝试更改文件名,然后再次尝试测试.希望对您有所帮助.
是的,此问题是由于缓存了图像,但是由于它是从数据库动态生成的,因此无法更改图像名称.
非常感谢ozkar指导我正确的方向. :)
现在要解决此问题,我要添加带有图像URL的查询字符串.我只需要替换代码中的一行&现在工作正常. :)
parentDiv.Style.Add("background-image", "url(''" + strImagePath + "'')");
替换为
parentDiv.Style.Add("background-image", "url(''" + strImagePath + "?x=" + imageId + "'')");
其中imageId在我的应用程序中是唯一的.可以在imageId位置使用任何唯一值.
谢谢
Prem Kishor
I am facing problem to show correct image in popup screen.
On Page load event I am getting image from database in the form of Base64String. I convert it into byte array & than generate a image file in ../temp/ location. after that I set style for background-image & pass the url ../temp/image.JPG.
This code is working fine for IE8 & other browser but problem occoured on IE9.
Below are the steps, when problem occoured.
Step 1 : I click on preview button for image 1.
Step 2 : I passed id = 1 to PopupImage screen.
Step 3 : On Page Load, fetch image on the basis on id = 1
Step 4 : Correct image will be shown
Step 5 : Now I click on preview button for image 2.
Step 6 : I passed id = 2 to PopupImage screen.
Step 7 : Still showing image for id = 1
Step 8 : Refreshing PopupImage screen, Correct image will be shown
It appears that the image is cached. You should try to change the file name and try your test again. I hope this helps.
Yes, This issue is due to cached image, but can''t change the image name as it is generating dynamically from database.
Thanks a lot for ozkar to direct me in right direction. :)
Now to resolve this issue I am adding a query string with image url. I had to replace only one line in my code & this is working fine now. :)
parentDiv.Style.Add("background-image", "url(''" + strImagePath + "'')");
replaced by
parentDiv.Style.Add("background-image", "url(''" + strImagePath + "?x=" + imageId + "'')");
Where imageId is unique in my application. Any unique value can be used at the place of imageId.
Thanks
Prem Kishor
这篇关于IE 9的ImagePopup屏幕中显示的图像不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!