Insert asp code in editor 4 for asp

Last post 02-17-2006, 9:31 AM by Vivamus. 11 replies.
Sort Posts: Previous Next
  •  09-30-2005, 8:29 AM 11232

    Insert asp code in editor 4 for asp

    How can i insert asp code in the editor without the editor converting the < tag to this code &lt; ?
     
    I can see that in this editor that is related to the forum you can set the <% without the conversion.
  •  10-01-2005, 12:16 AM 11268 in reply to 11232

    Re: Insert asp code in editor 4 for asp

  •  10-02-2005, 6:12 AM 11281 in reply to 11268

    Re: Insert asp code in editor 4 for asp

    When i go from HTML view to normal view and back again it has converted the code to &lt;% --- %&gt; in html view.
  •  10-04-2005, 8:32 AM 11358 in reply to 11281

    Re: Insert asp code in editor 4 for asp

    Can anybody help me out???
     
     
    A way to get around the problem is to replace the character code width the character < or >. How do i do that ??
     
    I want to replace it in html view
  •  10-04-2005, 1:32 PM 11370 in reply to 11358

    Re: Insert asp code in editor 4 for asp

    Which version of CuteEditor are you using?

    Can you try the following link?
     
     
    It works ok there.
     
     

    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-04-2005, 3:53 PM 11379 in reply to 11370

    Re: Insert asp code in editor 4 for asp

    Hi
     
    I can se that it works. It is the editor for ASP version 4. You think that it will work if i update i to the version 4.02?

    Is it editor for asp version 4.02 in the link you posted? 
  •  10-05-2005, 5:10 AM 11416 in reply to 11379

    Re: Insert asp code in editor 4 for asp

    Hi Adam
     
     
    The problem only appears in firefox. Anyway i can avoid that ?????
     
    I have downloaded the version 4.02
  •  10-05-2005, 3:07 PM 11435 in reply to 11416

    Re: Insert asp code in editor 4 for asp

  •  10-06-2005, 9:23 AM 11481 in reply to 11232

    Re: Insert asp code in editor 4 for asp

    I had the same issue and ended up writing an ASP function that "prepares" content for the editor (prepends and appends the comment tags to asp script tags) and then "fixes" content before posting back to the database (strips the comment tags).

    Seems to work pretty well.  However, you'll have to instruct anyone using the control that when adding NEW ASP code, they've got to input <!--<% to start the block, and %>--> to end the block, or the behavior you note will occur.

    Adam, in a post below, notes that the behavior is specific to gecko based browsers - it doesn't appear if you're using IE.  That's probably due to xml rendering engine differences.  It only makes sense that IE (microsoft) would treat the <% %> tag set as CDATA.  However, the <% %> tag set, being a Microsoft IIS only thing, is treated as normal input by the gecko based browsers.

    Anyway... here's the function... hopefully it makes it through the post intact.

    Function fixASPScriptTags(str,obj)
        'str = the string to process
        'obj = the object to process for: db=database;edit=editor
        fixASPScriptTags = str

        'if there's not an opening script tag (<%) in the string return the str as is and get out of here
        If InStr(fixASPScriptTags,"<" & Chr(37)) = 0 Then  Exit Function

        'otherwise process the thing.
        Dim percentTag : percentTag = Chr(37)
        Dim dbStartScript : dbStartScript = "<" & percentTag
        Dim dbStopScript :  dbStopScript = percentTag & ">"
        Dim editStartScript : editStartScript = "<!--<" & percentTag
        Dim editStopScript : editStopScript = percentTag & ">-->"
        Dim editStartScript2 : editStartScript2 = "<!--" & vbCRLF & "<" & percentTag
        Dim editStopScript2 : editStopScript2 = percentTag & ">" & vbCRLF & "-->"

        Select Case LCase(obj)
            Case "db"
                fixASPScriptTags = Replace(fixASPScriptTags,editStartScript,dbStartScript)
                fixASPScriptTags = Replace(fixASPScriptTags,editStopScript,dbStopScript)
                fixASPScriptTags = Replace(fixASPScriptTags,editStartScript2,dbStartScript)
                fixASPScriptTags = Replace(fixASPScriptTags,editStopScript2,dbStopScript)
            Case "edit"
                fixASPScriptTags = Replace(fixASPScriptTags,dbStartScript,editStartScript)
                fixASPScriptTags = Replace(fixASPScriptTags,dbStopScript,editStopScript)
        End Select
    End Function

  •  12-29-2005, 10:28 PM 14262 in reply to 11481

    Re: Insert asp code in editor 4 for asp

    This issue have been resolved in the version 5.0.

    Editor.AllowEditServerSideCode Property

    By default Cute Editor doesn't allow edit the Server side code. When this property is set to true, Cute Editor will allow edit the Server side code.

     


    Example Code

          <%
               Dim editor
               Set editor = New CuteEditor
               editor.ID= "Editor1"
               'When Editor.AllowEditServerSideCode Property is set to true, Cute Editor will allow edit the Server side code.
               editor.AllowEditServerSideCode = true
               editor.Text = "Hello World"
               editor.Draw()
          %>

     

    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

  •  02-16-2006, 10:16 AM 16003 in reply to 14262

    Re: Insert asp code in editor 4 for asp

    I'm sorry to burst your bubble, but it is still not working.  

    When I go (in Firefox 1.0.7) to your example link above, and enter <%= sShow %> in the code view, it looks correct in the code view, and disappears when I switch to html mode. Switch back to code view, and it still looks correct.  So far, all is well.

    Switch to Preview mode, however, and you get the behavior I am getting on every output, whether Preview mode is used (or even enabled):  The tag is converted to entities.

    This doesn't happen with IE.

    lkelly's posted hack function will work, but needs an additional bit to take care of comment tags WITHIN an asp tag, which would of course break it.  I'll try to post that later today, but it would be nice not to have to need it.

    Using the newest build of the ASP editor (5.0).

    Thanks for such an excellent editor.

    Vivamus


  •  02-17-2006, 9:31 AM 16069 in reply to 16003

    Re: Insert asp code in editor 4 for asp

    Some further information:

    lkelly's approach, while sensible, is causing some funny behavior inside the class.  Merely the existence of asp tags, even inside comments, appears to cause a large number of line breaks to be inserted into the output.  These are just physical CrLfs, not <br> tags, but it still makes the resultant html very messy.

    My add-on was to do a search inside each tag to disable the comment marks inside ASP tags, but with the above behavior, it would not be feasible.  The editor pokes so many line breaks into the output that any attempt to reassemble would be unreliable at best.

    For now, I've written a search on <% in the content, and locked out any browser other than IE if the content contains one.  That won't work very long, because I have a large client who wants to use Firefox for the editing.  By doing some tricky manipulating of content blocks, I can code around most areas where ASP tags are used, but not all -- and it is highly labor-intensive to do so.

    If I may make a suggestion, it seems the correct behavior would be:

        if in normal view, show a placeholder tag, such as <% CODE HERE %> with highlighting as Read Only, and skip without displaying from <% to %> while preserving literal content untouched.
        if in html view (and code editing enabled,) display asp tag (<% to %>) untouched, but allow editing.
        if in html view (and code editing NOT enabled,) display a placeholder tag, such as <% CODE CANNOT BE EDITED %> as Read Only.
        if in Preview mode, show a placeholder tag, such as <% CODE HERE %> with highlighting.

    I haven't looked inside the class to see what you are using to control the content flow, but there is (hopefully) a way to mark a a string to be preserved exactly within the manipulations for various displays and output.

    Thanks again for your product.
    Vivamus


View as RSS news feed in XML