Inserting gibberish into database (Using Dreamweaver MX8 .NET C#)

Last post 04-11-2006, 5:22 PM by Gaugu1n. 2 replies.
Sort Posts: Previous Next
  •  04-11-2006, 11:00 AM 18104

    Inserting gibberish into database (Using Dreamweaver MX8 .NET C#)

    I am trying to add the HTML generated by CuteEditor into a MS SQL database, but the code inserted is gibberish (stuff like: Thi#7 i#7 th#9 #1b#2#1f#5nt c#5l#5r="#0ff7320"#2b#5dy#1/f#5nt#2#1/b#2#1br#2)

    I am using Dreamweaver ASP.NET C#

    Here is a sample code (could you please let me know what I need to change and where (a previous reponse to a similar question hasn't helped at all, as I am not sure where the code suggested goes)).

    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="UTF-8" %>

    <%@ Import Namespace="System.Data" %>

    <%@ Import Namespace="System.Data.OleDb" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    <%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>

    <MM:Insert

    runat="server"

    CommandText='<%# "INSERT INTO Site.tbl_NewsItem (NewsItemBody) VALUES (@NewsItemBody)" %>'

    ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_connXXXX"] %>'

    DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_connXXXX"] %>'

    Expression='<%# Request.Form["MM_insert"] == "form1" %>'

    CreateDataSet="false"

    SuccessURL='<%# "/cs/testeditor.aspx" %>'

    Debug="true"

    >

      <Parameters>

        <Parameter Name="@NewsItemBody" Value='<%# ((Request.Form["NewsItemBody"] != null) && (Request.Form["NewsItemBody"].Length > 0)) ? Request.Form["NewsItemBody"] : "" %>' Type="NVarChar" />

      </Parameters>

    </MM:Insert>


    <HTML>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <HEAD>


    <TITLE>TEST</TITLE>


    </HEAD>

    <BODY>

    <FORM name="form1" id="form1" runat="server">

    <table align="center">

        <tr valign="baseline">

          <td nowrap align="right" valign="top">NewsItemBody:</td>

          <td><CE:Editor id="NewsItemBody" EditorWysiwygModeCss="../example.css" runat="server" ></CE:Editor></td>

        </tr>

        <tr valign="baseline">

          <td nowrap align="right">&nbsp;</td>

          <td><input type="submit" value="Insert record"></td>

        </tr>

      </table>

    <input type="hidden" name="MM_insert" value="form1">

    </FORM>

    </BODY>

    </HTML>

  •  04-11-2006, 1:55 PM 18108 in reply to 18104

    Re: Inserting gibberish into database (Using Dreamweaver MX8 .NET C#)

    Gaugu1n,
     
    Editor.EncodeHiddenValue Property

    By default Cute Editor will encode the value in the Hidden field automatically. You can turn it off by setting this property to "false".
     

     
     
     

    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

  •  04-11-2006, 5:22 PM 18123 in reply to 18108

    Re: Inserting gibberish into database (Using Dreamweaver MX8 .NET C#)

    Thanks Adam

    I was a little puzzled as I couldn't find this property anywhere. The fact is that the default code doesn't display the property e.g.
    <CE:Editor id="NewsItemBody" EditorWysiwygModeCss="../example.css" runat="server" ></CE:Editor>

    So I had to put EncodeHiddenValue="false" there myself and ensure it was set to false e.g.
    <CE:Editor id="NewsItemBody" EditorWysiwygModeCss="../example.css" EncodeHiddenValue="false"  runat="server" ></CE:Editor>

    However it requires that ValidateRequest="false" be added to the page directive like so (or your page will generate an error):
    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="UTF-8" ValidateRequest="false" %>

    W
View as RSS news feed in XML