Professional Web Applications Themes

dealing with nulls.... - ASP

<% Function GetContactDetails( _ ByVal strEmail, _ ByVal strWWW _ ) If isNull(strWWW) then GetContactDetails = _ "<a href=""mailto:" & strEmail & "?subject=" & "Enquiry via The Business and Community Handbook"">Email Us</a>" Else If not isNull(strEmail) then GetContactDetails = "<a href=""http://" & strWWW & """ target=" & "_blank"">Visit Us</a>" Else ' both values are NULL, so do what you want here End If End If End Function %> "John Pether" <john<nospam>dotnetsites.net> wrote in message news:u0$XLOERDHA.2148TK2MSFTNGP10.phx.gbl... : Ive got the following code which displays one of two fields depending on whether the first one is null or not. However I also ...

  1. #1

    Default Re: dealing with nulls....

    <%
    Function GetContactDetails( _
    ByVal strEmail, _
    ByVal strWWW _
    )

    If isNull(strWWW) then

    GetContactDetails = _
    "<a href=""mailto:" & strEmail & "?subject=" & "Enquiry via The
    Business and Community Handbook"">Email Us</a>"

    Else

    If not isNull(strEmail) then

    GetContactDetails = "<a href=""http://" & strWWW & """ target=" &
    "_blank"">Visit Us</a>"

    Else

    ' both values are NULL, so do what you want here

    End If

    End If

    End Function
    %>




    "John Pether" <john<nospam>dotnetsites.net> wrote in message
    news:u0$XLOERDHA.2148TK2MSFTNGP10.phx.gbl...
    : Ive got the following code which displays one of two fields depending on
    whether the first one is null or not. However I also want to cater for the
    possibility that both fields are null, and display nothing or an image, how
    would I do this??
    :
    : <%
    : strEmail = GetListings.Fields.Item("Email").Value
    : strWWW = GetListings.Fields.Item("WWW").Value
    : %>
    : <%
    : Function GetContactDetails( _
    : ByVal strEmail, _
    : ByVal strWWW _
    : )
    :
    : If isNull(strWWW) then
    : GetContactDetails = "<a href=""mailto:" & strEmail & "?subject=" &
    "Enquiry via The Business and Community Handbook"">Email Us</a>"
    : Else
    : GetContactDetails = "<a href=""http://" & strWWW & """ target=" &
    "_blank"">Visit Us</a>"
    : End If
    :
    : End Function
    : %>
    :
    : <td><%=GetContactDetails(strEmail, strWWW)%></td>
    :
    : ************************************************** ********************
    : Sent via Fuzzy Software [url]http://www.fuzzysoftware.com/[/url]
    : Comprehensive, categorised, searchable collection of links to ASP &
    ASP.NET resources...


    Ken Schaefer Guest

  2. #2

    Default Re: dealing with nulls....

    thanks for your help:) Unfortunately that code doesn't work for me?? I still get and empty email us link???

    Any ideas?


    ************************************************** ********************
    Sent via Fuzzy Software [url]http://www.fuzzysoftware.com/[/url]
    Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
    John Pether (john@ Guest

  3. #3

    Default Re: dealing with nulls....

    Sorry, I mis-read your original code.

    Now it's supposed to work like this:

    If WWW is NULL then

    If Email is NOT NULL then

    ' return email link

    Otherwise Email is NULL

    ' so do what you want

    Else WWW is NOT NULL so

    ' write WWW link

    Cheers
    Ken

    <%
    Function GetContactDetails( _
    ByVal strEmail, _
    ByVal strWWW _
    )

    If isNull(strWWW) then

    If not isNull(strEmail) then


    GetContactDetails = _
    "<a href=""mailto:" & strEmail & "?subject=" & "Enquiry via The
    Business and Community Handbook"">Email Us</a>"
    Else

    ' both values are NULL, so do what you want here

    End If

    Else

    GetContactDetails = "<a href=""http://" & strWWW & """ target="
    &"_blank"">Visit Us</a>"

    End If

    End Function
    %>



    "John Pether" <john<nospam>dotnetsites.net> wrote in message
    news:OzgoihERDHA.3144tk2msftngp13.phx.gbl...
    : thanks for your help:) Unfortunately that code doesn't work for me?? I
    still get and empty email us link???
    :
    : Any ideas?
    :
    :
    : ************************************************** ********************
    : Sent via Fuzzy Software [url]http://www.fuzzysoftware.com/[/url]
    : Comprehensive, categorised, searchable collection of links to ASP &
    ASP.NET resources...


    Ken Schaefer Guest

  4. #4

    Default Re: dealing with nulls....

    Great!!

    Thanks for your help:)

    ************************************************** ********************
    Sent via Fuzzy Software [url]http://www.fuzzysoftware.com/[/url]
    Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
    John Pether (john@ Guest

Similar Threads

  1. How to return default value for NULLs?
    By sblue in forum Coldfusion Database Access
    Replies: 6
    Last Post: October 10th, 07:42 PM
  2. How do I check for nulls? IsNull??
    By bflophil in forum Macromedia ColdFusion
    Replies: 0
    Last Post: February 18th, 11:22 PM
  3. empty strings vs nulls
    By Eric Walker in forum Perl / CGI
    Replies: 5
    Last Post: November 25th, 02:16 AM
  4. Casting nulls
    By Carl Furst in forum PHP Development
    Replies: 3
    Last Post: September 24th, 11:39 PM
  5. Problem with nulls
    By Bob in forum ASP.NET General
    Replies: 1
    Last Post: July 2nd, 08:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139