Displaying default Image in a list when the container item is null

Vote:
 
Hello I would like to display a default image on a list when there is no value in the appropriate field Image55x74. I would like to put an if statement either in the cs or the aspx file but I am not sure how to access a value from a Container. Does anyone know how to do this? I imagine that if i did it in the CS code it would be something line this: protected static string GetThumbnailImage() { if (Container.CurrentPage["Image55x74"] != null) return (Container.CurrentPage["Image55x74"]); return "default.gif"; } The aspx could look something like this: This doesn't work as Container is not recognised. Thanks. Victor
#13081
Mar 25, 2008 18:35
Vote:
 
This was answer was given to me. You could do the following: ’ alt=”” /> OR, ’ alt=”” /> protected static string GetThumbnailImage(PageData pd) { return (pd["Image55x74"] != null ? pd["Image55x74"] : "default.gif"); } Both solutions expect the Property Image55x74 to be a string. If not – you have to cast it to a string.
#15379
Mar 25, 2008 18:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.