Live Support, Chat, Upload Control and Rich Text Editor
Welcome to Support forums Sign in | Join | Help |Client Center
in Search

How do I display a value (text) in the editor on page load? I'm a newbie...please help!

Last post 05-26-2009, 10:13 AM by Adam. 7 replies.
Sort Posts: Previous Next
  •  05-18-2009, 10:52 AM 52272

    How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    Hello,
     
     I am new with asp.net and cute editor and I'm trying to create a simple content management system.  I am trying to display a value in the editor when the page loads.  This value will be pulled from a database and updated when the page/editor is submitted.
     
    I've used fckeditor with php and it looked like this: 
     
    $oFCKeditor = new FCKeditor('FCKeditor1') ;
                        $oFCKeditor->BasePath = 'fckeditor/' ;
                        $oFCKeditor->Value = $page_copy;
                        $oFCKeditor->Create() ;
     
    Where the $page_copy variable was the database value displayed when the editor loaded.  Is there some type of "value=..." with the cute editor for asp.net?  I'm sure this is pretty simple but I can't figure it out!  Thanks so much....I really appreciate your help!
     
    -Brett
  •  05-18-2009, 3:03 PM 52288 in reply to 52272

    Re: How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    Brett,
     
    I think the above code is not ASP.NET. It's written in PHP.
     
    Here is a simple example showing you how to set CuteEditor Text.
     
    1. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>  
    2. <%@ Page language="c#"%>  
    3. <html>  
    4.     <head>  
    5.     </head>  
    6.     <body>  
    7.         <form id="Form1" method="post" runat="server">  
    8.             <CE:EDITOR id="Editor1" Autoconfigure="Simple" runat="server"></CE:EDITOR>  
    9.         </form>  
    10.     </body>  
    11. </html>  
    12.   
    13. <script runat="server">  
    14.     void Page_Load(object sender, System.EventArgs e)   
    15.      {   
    16.         if (IsPostBack)    
    17.         {    
    18.         }    
    19.         else    
    20.         {      
    21.             Editor1.Text = "Set Text Here";   
    22.         }    
    23.        
    24.     }   
    25. </script>  

    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

  •  05-18-2009, 4:04 PM 52296 in reply to 52288

    Re: How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    Adam,
     
    Thanks so much for your reply!  The code in my original question was in php, sorry I didn't phrase it better, I just wanted to show that as an example of what I was trying to duplicate in asp.net.  I tried your script and I keep getting this error:
     
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30188: Declaration expected.
     
     
    And this line is highlighted: 
    void Page_Load(object sender, System.EventArgs e)  


    Should I change this line? Other variables?
    Also, does it have to be below the </html> tag?
    Sorry, I'm a real beginner! Thanks again for your help :)

    -Brett
  •  05-19-2009, 3:42 AM 52308 in reply to 52296

    Re: How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    Hi btor10,
     
    Can you post all your code here?
     
    Regards,
     
    ken
  •  05-19-2009, 8:30 PM 52337 in reply to 52308

    Re: How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    1. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>    
    2.   
    3. <%@ Page Title="" Language="c#" AutoEventWireup="false" MasterPageFile="~/MasterPages/Admin.Master" CodeBehind="admin_edit_content.aspx.vb" Inherits="millelacssite.admin_edit_content" %>  
    4. <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
    5. </asp:Content>  
    6. <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
    7.   
    8. <script language="JavaScript" type="text/javascript" >  
    9.   
    10.         //Need to figure out how to display value in editor!!!  
    11.           
    12.                 // get the cute editor instance  
    13.                 //var editor2 = document.getElementById('<%=Editor2.ClientID%>');  
    14.                   
    15.                 // Get the editor HTML  
    16.                 //document.getElementById("<%=Editor2.ClientID%>").value = 'hello there';  
    17.                   
    18.                 //editor1.getHTML();  
    19.                   
    20.           
    21.                 // get the cute editor instance  
    22.                 //var editor2 = document.getElementById('<%=Editor2.ClientID%>');  
    23.                   
    24.                 // Set the editor  
    25.                 //editor2.setHTML(document.getElementById("<%=Editor2.ClientID%>").value);  
    26. </script>  
    27.   
    28. <script runat="server">  
    29. protected void Page_Load( object sender, EventArgs e )  
    30.     {  
    31.         if ( Page.IsPostBack )  
    32.             return;  
    33.   
    34.         // Set the startup editor value.  
    35.         Editor2.Text = "<p>This is some <strong>sample text</strong>. You are using <a href=\"http://www.fckeditor.net/\">FCKeditor</a>.</p>";  
    36.     }  
    37. </script>  
    38.   
    39.   
    40.   
    41.   
    42.   
    43. <div id="content">  
    44.     <h1>Website Content</h1>  
    45.     <p>You are editing >> (page name here)</p>  
    46.       
    47.      <form id="Form2" runat="server">  
    48.           
    49.         <%--display cute editor with less toolbar options--%>  
    50.           
    51.         <!--the editor will be displayed with the page content from the "content" table for the appropriate page,  
    52.             page id will be grabbed using get method through page link on admin_website_content.aspx,  
    53.             ex: admin_edit_content.aspx?pageid=1 is the link to edit the homepage-->  
    54.               
    55.         <CE:Editor   
    56.             ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/simple.config"  
    57.             id="Editor2"   
    58.             runat="server">  
    59.         </CE:Editor>  
    60.         <br />  
    61.     
    62.           
    63.         <input id="Submit1" type="submit" value="Submit" runat="server" />  
    64.           
    65.      </form>  
    66. </div><!--end content-->  
    67.   
    68. </asp:Content> 

     
     
  •  05-20-2009, 4:11 PM 52370 in reply to 52337

    Re: How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    Hi bthor10,
     
    Please remove the   <form id="Form2" runat="server">  </form>  tag and try again.
     
    Regards,
     
    Ken
  •  05-26-2009, 8:56 AM 52504 in reply to 52370

    Re: How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    Nope, that didn't work....thanks for the suggestion though!  I would think this would be very simple... I'm using the editor for a content management system so I need to display the xhtml from a db table.  I just need to know how to display something in the editor so I can switch in the xhtml content as a variable.  Isn' t this how the editor is commonly used?!  I'm confused, ha!  Thanks again for your help!


    -Brett
  •  05-26-2009, 10:13 AM 52508 in reply to 52337

    Re: How do I display a value (text) in the editor on page load? I'm a newbie...please help!

    1. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>    
    2.   
    3. <%@ Page Title="" Language="c#" AutoEventWireup="false" MasterPageFile="~/MasterPages/Admin.Master" CodeBehind="admin_edit_content.aspx.vb" Inherits="millelacssite.admin_edit_content" %>     
    4.   
    5. <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
    6. </asp:Content>     
    7.   
    8. <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">     
    9.      
    10.   
    11. <script runat="server">    
    12.        
    13.     Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)   
    14.         MyBase.OnInit(e)   
    15.        
    16.         Editor2.Text = "Some Text Here"  
    17.     End Sub   
    18.   
    19. </script>       
    20.   
    21.      
    22.   
    23. <div id="content">     
    24.   
    25.     <h1>Website Content</h1>     
    26.   
    27.     <p>You are editing >> (page name here)</p>           
    28.   
    29.      <form id="Form2" runat="server">               
    30.   
    31.         <%--display cute editor with less toolbar options--%>               
    32.   
    33.         <!--the editor will be displayed with the page content from the "content" table for the appropriate page,     
    34.   
    35.             page id will be grabbed using get method through page link on admin_website_content.aspx,     
    36.   
    37.             ex: admin_edit_content.aspx?pageid=1 is the link to edit the homepage-->     
    38.   
    39.                  
    40.   
    41.         <CE:Editor      
    42.             ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/simple.config"    
    43.             id="Editor2"    
    44.             runat="server">     
    45.         </CE:Editor>     
    46.   
    47.         <br />                  
    48.   
    49.         <input id="Submit1" type="submit" value="Submit" runat="server" />               
    50.   
    51.      </form>     
    52.   
    53. </div><!--end content-->       
    54.   
    55. </asp:Content>    

    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

View as RSS news feed in XML
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.