Tobias
|
Posted: 09/22/2003, 2:55 AM |
|
Hi forum,
I have got a link in a grid form, which is only needed, if a databasefield has a special value.
I want to hide this link if the value of this databasefield has a different value.
Does anyone know how to do this?
Thanks in Advance!
Tobias
|
|
|
RonB
|
Posted: 09/22/2003, 8:05 AM |
|
You might consider posting your enviroment specs: coding language etc.
|
|
|
Tobias
|
Posted: 09/23/2003, 12:11 AM |
|
Sorry,
ASP 3 with Templates.
I now solved it this way:
----- ASP-file -----------
' Link nur anzeigen wenn Computertyp = DHCP
if Recordset.Fields("DHCP") = "DHCP" then
DHCP.Value = "pics\dhcp.ico"
else
DHCP.Value = "pics\blank.gif"
end if
------- Template-file ----------
<a href="{DHCP_Src}"><img src="{DHCP}"></a>
------------------------
But in case of blank.gif (1x1 pixel, white), the link-border is still there, because the img-tag is between the a-tag.
I'm now trying to do it like this:
' Link nur anzeigen wenn Computertyp = DHCP
if Recordset.Fields("DHCP") = "DHCP" then
DHCP.Value = "<img src='pics\dhcp.ico'>"
else
DHCP.Value = ""
end if
But when I now look at the result, this img-tag is not interpreted. Instead of the picture, the html-tag is shown.
Whats the problem?
I hope you understand what I mean. I have to practice my english...
|
|
|
RonB
|
Posted: 09/23/2003, 4:52 AM |
|
The problem, as i see it, is that you are passing the image info but you are not telling the page what to do with it. It will always assume there is an <a> tag comming with info that has to be transformed in to a link. I think you should set the link to label and change the code to:
I'm now trying to do it like this:
' Link nur anzeigen wenn Computertyp = DHCP
if Recordset.Fields("DHCP") = "DHCP" then
DHCP.Value = "<a href=(insert link value here in asp)><img src='pics\dhcp.ico'>"
else
DHCP.Value = ""
end if
Set the label to html.
In php your example would look like this
global $gridname;
if($gridname->Labelname->Value =="DHCP")
{
$gridname->labelname->SetValue("<a href=" .$gridname->labelname->Value ."<img src='pics\dhcp.ico'>");
}else
$gridname->labelname->SetValue("");
Ron
|
|
|
|