Monday, September 13, 2010

Best way to display default image if specified image file is not found?



Best way to display default image if specified image file is not found?
Many times in grid/repeater or even in image display we have a problem if we don’t find any image related to that ID/Record and to replace “X” sign or image not found message we need to do programming but here is the
Quick solution which saves lot’s of your time and also your server processing time.

Just put following code in your in your image control.

onerror="this.onerror=null;this.src='Noview.jpg'"
Below is the full code for that


Above code first try to found image at “FullLocationImage”,but if it don’t find an image at specified path it will show “NoViewImage”

No comments:

Post a Comment