If you bind the image to an <asp: Image> control you can toggle the Visibility property from true to false, depending on the existence of an image, or image file path in the returned records. Here are some ways to achieve that.
C#:
Visible='<%# Eval("ImageFile")!=DBNull.Value %>'
Or
Visible='<%# Eval("ImageFile")==DBNull.Value ? false: true %>'
Or, if using a DataSource Control, this can be handled in the Item_DataBound Event:
VB.Net
Visible=<%# IIf(Eval("ImageFile") Is DbNull.Value, "False","True") %>'
Or
Visible='<%# Eval("ImageFile")<>DBNull.Value %>'
Date Posted:
04 April 2007 21:45
©Mike Brind 2006 - 2012. All rights reserved.