In ASP. NET, the image control cannot be automatically refreshed.

Source: Internet
Author: User

Source: http://www.study-code.com/dotnet/aspnet/67496.htm

Use the image control in Asp.net. When you want to dynamically change the image content, you can directly use the imageurl attribute to point to the new image path (eg: image. imageurl = ImagePath ). However, when you update the original image content rather than directly changing the image path, the image will not be updated even if you re-Execute image1.imageurl = ImagePath. In addition, you cannot refresh the image. The image is still the original one.

I don't know why. Net does not change when determining the imageurl attribute because the two paths are the same before and after, and the forced dispose is invalid. The original solution is very simple. You only need to add a random parameter after the image path to make the server think the image has changed. Eg: image. imageurl = ImagePath + "? Temp = "+ datetime. Now. tostring () This example uses the current time as a random number. The trouble for one afternoon is solved only in the middle of the bullet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.