How to show text on editor from variable

Last post 08-11-2010, 11:27 AM by Eric. 1 replies.
Sort Posts: Previous Next
  •  08-10-2010, 11:07 PM 63312

    How to show text on editor from variable

    In ASP pages, I use textarea to display text from database.
    I use datareader and assign the value to a variable: description
    then show it in the textarea: <textarea name=background ><%=description%></textarea>
     
    I found that if I use cuteeditor instead of textarea, I cannot retrieve the variable by this method
    <CE:Editor ID="Editor_Background" runat="server" AutoConfigure="None" Text='<%=description%>'></CE:Editor>
    there is nothing on the editor
    But when I change the Text ="123", it shows '132'
     
    how to show  on editor from variable?
     
  •  08-11-2010, 11:27 AM 63333 in reply to 63312

    Re: How to show text on editor from variable

    You can try the following code:
    <%@ Page Language="C#" %>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
    <head>
    </head>
    <body>
        <form id="Form1" runat="server">
        <CE:Editor ID="Editor1" EditorWysiwygModeCss="../example.css" ThemeType="Office2007"
            EditCompleteDocument="true" AllowPasteHtml="false" runat="server">
        </CE:Editor>
        <br>
        <asp:Button ID="btnUpdate" OnClick="Submit" runat="server" Text="Submit"></asp:Button><br />
        <asp:TextBox ID="textbox1" runat="server" TextMode="MultiLine" Height="250px" Width="750px"
            Font-Name="Arial"></asp:TextBox>
        </form>
    </body>
    </html>
    <script runat="server">
      
        void Page_Load(object sender, System.EventArgs e)
        {
            if (IsPostBack)
            {
                Editor1.SaveFile("document.htm");
                textbox1.Text = Editor1.Text;
            }
            else
            {
                Editor1.Text = "123";
            }
        }
        public void Submit(object sender, System.EventArgs e)
        {
            Editor1.SaveFile("document.htm");
            textbox1.Text = Editor1.Text;
        }
    </script>
    But when I change the Text ="123", it shows '132',  can you send your full code to me which can reproduce this issue? We will check it on our end.
     
    Regards,
    Eric
View as RSS news feed in XML