Use alternate image field
Posted on 2010-01-11
I have created a small function to return an alternate image if the origional image field is empty as per the code below:
ImageUrl='<%# FixNullBind(Eval("PTProductImage")) %>'
Public Function FixNullBind(ByVal sItem As Object) As String
If IsDBNull(sItem) Then
' Return ("/images/logo.jpg")
Return ("<%# Bind(" + "" + "GFImageURL" + "" + ")%>")
This works fine if I populate the return with the hardcoded image location, however I would like to use an image ("GFImageURL") in the same table that will always be populate even if the original ("PTProductImage") isn't. In debugging I can look at the return and it is poulated with
<%# Bind("GFImageURL")%> as I had planned but this is not being translated to the record withing this field.
Assistance most welcome.