flipandboef
Posts: 107
|
| Posted: 12/20/2006, 8:28 AM |
|
Ok I have to tackle one more issue before I have completed my mission....
I have created a gallery where I will have 4 pictures (4 columns) showing pictures with 2 labels under it, called Number and Color...
Some of the pictures however are not on the server and I would like to hide the row containing that picture and the 2 labels in that case, but still show the pictures and labels for the ones where there is picture is found on the server..
I have tried add custom code in the BeforeShow on the RowComponents (where the Image and the 2 labels are located) and tried on the BeforeShowRow, using these codes:
Custom code 1 (to set the value from the picture to "" if the picture is not found - this works good)
Dim filespec, fso
filespec = (Prods.Photo.Value)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(Server.MapPath("/" & filespec) ) Then
Prods.Photo.Value = filespec
Else
Prods.Photo.Value = ""
End if
Custom code 2 (to hide the row when the imagevalue="")
If Prods.Photo.Value = "" then
Prods.RowComponent.visible=true
else
Prods.RowComponent.visible=false
end if
To bad this does not work... They still show up 
I have tried to add this code instead of on the RowComponent, on the Grid: Prods itself, but this results that it's hiding everything!
Another way I have tried to do this is via the SQL...
In the SQL statement I putthe Expression: Where Photo <> "nopic"
Only problem I have there is that I have to check the image file to see if it exists on the server with the code shown as above:
Dim filespec, fso
filespec = (Prods.Photo.Value)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(Server.MapPath("/" & filespec) ) Then
Prods.Photo.Value = filespec
Else
Prods.Photo.Value = "nopic"
End if
However, I am cluless where I can put this code so that when the data is retrieved, the image is set first.
In short said what I need in the Gallery:
When the image exist on the server, then show the picture and 2 labels from that record. If not, hide them.
Anyone who can point me towards the correct direction?
|
 |
 |
|