Forums
This topic is locked
If Else Then question
Posted 05 Mar 2001 17:34:21
1
has voted
05 Mar 2001 17:34:21 Michael Guntenaar posted:
<font face='Verdana'></font id='Verdana'>Hi there <img src=icon_smile_approve.gif border=0 align=middle>
Gotta question here .
In my table I get the dynamic text of my database (title)
Now I wan't to let that Dynamic text (title to to 2 things depending on a condition)
I want it to check for the URL field "is there data in it" then I will follow the URL specified in that field (like an news item on an other website) but... If there is no data in the URL field I want it to go a detailed page (detail.asp?ID=....).
I have fixed the problem with the conditional region with ICONS the first Icon links to the link specified in the URL field.
The right Icon links to the default page .
So I wan't it to combine this two icons in 1 action .
I think its possible but Im not good at If & Else statements .
Somebody please help me!!!
many thnax in advance
Replies
Replied 08 Mar 2001 14:47:12
08 Mar 2001 14:47:12 keiron keiron replied:
<% IF (rsRecordset.Fields.Item("thelinkfield".Value) > "0" Then %>
<a href="<%=(rsRecordset.Fields.Item("thelinkfield".Value)%>"><%=(rsRecordset.Fields.Item("title".Value)%></a>
<% ELSE %>
<a HREF="thedetailpage.asp?"ID=<%=(rsRecordset.Fields.Item("ID".Value)%><%=(rsRecordset.Fields.Item("title".Value)%></a>
<% end if %>
Basically, create the link as you would normally, going to the value in the link field. Also create it as if you were going to a detail page - right next to it so you have 2 ogether., Then split them up with the IF THEN statement.. The IF is saying, IF there is something in the link field, THEN go to the link shows, ELSE go to a detail page.
<a href="<%=(rsRecordset.Fields.Item("thelinkfield".Value)%>"><%=(rsRecordset.Fields.Item("title".Value)%></a>
<% ELSE %>
<a HREF="thedetailpage.asp?"ID=<%=(rsRecordset.Fields.Item("ID".Value)%><%=(rsRecordset.Fields.Item("title".Value)%></a>
<% end if %>
Basically, create the link as you would normally, going to the value in the link field. Also create it as if you were going to a detail page - right next to it so you have 2 ogether., Then split them up with the IF THEN statement.. The IF is saying, IF there is something in the link field, THEN go to the link shows, ELSE go to a detail page.
Replied 08 Mar 2001 20:05:30
08 Mar 2001 20:05:30 Michael Guntenaar replied:
<font face='Verdana'></font id='Verdana'>
THNX very much Keiron, Im gonna try it tomorrow right away <img src=icon_smile_big.gif border=0 align=middle>
Ill keep you up to date!!!
thnx again
Michael
THNX very much Keiron, Im gonna try it tomorrow right away <img src=icon_smile_big.gif border=0 align=middle>
Ill keep you up to date!!!
thnx again
Michael