HTMLEncode problems on null values...

Last post 10-11-2005, 2:39 PM by lkelly. 2 replies.
Sort Posts: Previous Next
  •  10-11-2005, 6:08 AM 11620

    HTMLEncode problems on null values...

    Hi...

    I've seen other postings on this error but not official solution to it yet.... When reading information from a memo field from MS Access or a text field from MS SQL and the field is null, then I'm getting the following HTMLEncode error.

    Error Type:
    Microsoft VBScript runtime (0x800A000D)
    Type mismatch: 'HTMLEncode'
    /CuteEditor/CuteEditor_Files/include_CuteEditor.asp, line 891

    As I mentioned, I've seen errors on this before... and there have been various ideas - one was just to remove the HTMLEncode from around s_text and then you don't get the Encode problem - but what effect does that have on the editor - I assume the code is there for a reason.

    Appologies if anotehr solution has been posted and I haven't found it yet... and thanks in advance for the response...
     
    R.
  •  10-11-2005, 11:41 AM 11636 in reply to 11620

    Re: HTMLEncode problems on null values...

    You can do something like this:
     
    If memofield = null then
        // set the editor to empty 
        editor.Text = ""
    Else
        // pass the memofield  to the editor
        editor.Text = memofield 
    End If

    Hope it helps.
     
    Let me know if you have any further questions.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-11-2005, 2:39 PM 11641 in reply to 11636

    Re: HTMLEncode problems on null values...

    You could also modify your sql statement to use the isnull() function...  this would place the onus on the db server (where it belongs)...

    In the select statement, you'd have something like:  select id, isnull(fldName,'') where... etc.  The isnull function returns the contents of the field if it ISN'T null, and the 2nd parameter (empty) if it is.
View as RSS news feed in XML