Albert
|
Posted: 08/29/2003, 1:42 PM |
|
I've created a simple grid in CCS 2, asp(vbscript). I would like to turn the variable of one column into a image link. But, I need to be able to make the image change depending what the varialbe is. For instance, the variable is of data type boolean, if the variable is True then I want image_1 to appear as a link with the ID of that record as a parameter. If the record is False then image_2 will appear as a link with the ID of the that record as a parameter.
Does anyone know how I can accomplish this? I'm able to get the image to come in as a link, but I'm unable to insert the ID for the record as a parameter in the link. This is what I have so far:
If Grid.variable.Value Then
Grid.variable.Value = "<a href=MoreInfo.asp?ID=><img border=""0"" src=""image_1.gif""></a>"
Else
Grid.variable.Value = "<a href=MoreInfo.asp?ID=><img border=""0"" src=""image_2.gif""></a>"
End If
Everytime I try to insert Grid.ID.Value after "...asp?ID=" I get an error.
Does anyone know how I can accomplish this?
|
|
|
Hamilton
|
Posted: 08/29/2003, 11:48 PM |
|
An alternative method:
In your grid, place a label in the column where you want the dynamic image to appear. Call it lblMoreInfo.
In the Before_Show Event, place the following code.
You will need to replace the values contained within the <> tags to the appropiate gridname and field name.
On Error Resume Next
Dim lngID
Dim sResult
lngID = <GridName>.datasource.recordset.fields("<fieldname>")
If lngID = 1 Then
sResult = "<a href=MoreInfo.asp?ID=" & lngID & "><img border=""0"" src=""image_1.gif""></a>"
Else
sResult = "<a href=MoreInfo.asp?ID=" & lngID & "><img border=""0"" src=""image_2.gif""></a>")
End If
<gridname>.lblMoreInfo.value = sResult
|
|
|
|