Reg- Making Cute Editor content window read only

Last post 08-16-2010, 7:37 AM by rajmohanp. 6 replies.
Sort Posts: Previous Next
  •  08-12-2010, 6:40 AM 63354

    Reg- Making Cute Editor content window read only

    Hi,
     
     In our project we need to make our cute editor control  editor window as Read Only, we dint find any option to make the editor window as Read Only, when i use ReadOnly property of cute editor it disables all the controls. So please get me a solution for this.

     
    Thanks,
    Rajmohan P
  •  08-12-2010, 8:53 AM 63355 in reply to 63354

    Re: Reg- Making Cute Editor content window read only

    Please refer to http://cutesoft.net/example/readonly.aspx, the code are as follows:
    <CE:Editor id="Editor1" ReadOnly="true" ThemeType="Office2007" EditorWysiwygModeCss="../example.css" runat="server" ></CE:Editor>
     
    If you want to set it dynamically, the following is a full example:
    <%@ Page Language="C#"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
        <head>
      <title>ASP and ASP.NET WYSIWYG Editor - Read only example</title>  
     </head>
     <body>
            <form id="Form1" runat="server">   
       <CE:Editor id="Editor1" ReadOnly="true" ThemeType="Office2007" EditorWysiwygModeCss="../example.css" runat="server" ></CE:Editor>
      </form>
     </body>
    </html>
    <script runat="server">
     void Page_Load(object sender, System.EventArgs e)
      {
         if (IsPostBack)
      {    
         }
      else
      {
                Editor1.ReadOnly = true;
      }
     }
     public void Submit(object sender, System.EventArgs e)
     { 
     }
    </script>
     
    Regards,
    Eric
     
  •  08-12-2010, 10:28 AM 63361 in reply to 63355

    Re: Reg- Making Cute Editor content window read only

    Dear Eric,
     
     Thanks for your reply. I have tried the code you given already, but it is disabling entire control including the buttons on the top like Insert image, font style etc. But i need to disable only the textarea in which we are typing the content. In other words i want my users to disable editing the content which is loaded by default.
     
    Waiting for your favourable reply asap.
     
    Thanks,
    rajmohan
  •  08-13-2010, 1:36 AM 63369 in reply to 63361

    Re: Reg- Making Cute Editor content window read only

    Hi rajmohanp,
     
    Please try the example below
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5. <html xmlns="http://www.w3.org/1999/xhtml">   
    6. <head runat="server">   
    7.     <title>Untitled Page</title>   
    8. </head>   
    9.   
    10. <script runat="server">   
    11.     protected override void OnLoad(EventArgs e)   
    12.     {   
    13.         editor1.Text = "please try change me";   
    14.         base.OnLoad(e);   
    15.     }   
    16. </script>   
    17.   
    18. <body>   
    19.     <form id="form1" runat="server">   
    20.         <div>   
    21.             <CE:Editor ID="editor1" runat="server" ShowBottomBar="false" EnableContextMenu="false">   
    22.             </CE:Editor>   
    23.         </div>   
    24.     </form>   
    25. </body>   
    26. </html>   
    27.   
    28. <script>   
    29.   
    30. function disableBoardEvent(oEvent)   
    31. {   
    32.     oEvent.preventDefault();      
    33. }   
    34.   
    35. function CuteEditor_OnInitialized(editor)   
    36. {   
    37.     var editwin = editor.GetWindow();   
    38.     var editdoc = editor.GetDocument();   
    39.     if(window.addEventListener)   
    40.     {   
    41.         editdoc.addEventListener("keypress",disableBoardEvent,"false");   
    42.     }   
    43.       
    44.     editdoc.body.onkeydown=function()   
    45.     {   
    46.         return false;   
    47.     }   
    48.      
    49.   
    50. }   
    51.   
    52. </script>  
    Regards,
     
    ken
  •  08-13-2010, 5:43 AM 63374 in reply to 63369

    Re: Reg- Making Cute Editor content window read only

    Hi,
     The above post is useful for me in some ways, but its not giving me the proper solution, the text formatting, and all working, as well as the enter key is working in Firefox browser.
    When i Insert an image and select then i delete that, its deleting, please help me.
     
    In Internet Explorer still i can edit the content
     
    Thanks,
    Rajmohan P
  •  08-16-2010, 4:27 AM 63415 in reply to 63374

    Re: Reg- Making Cute Editor content window read only

    Hi rajmohanp,
     
    I tested the code on IE7 and IE8 in works on both.
     
    About the image issue. for now can not prevent users deleting. Except set ReadOnly="true".
     
    Regards,
     
    Ken
  •  08-16-2010, 7:37 AM 63419 in reply to 63415

    Re: Reg- Making Cute Editor content window read only

    Dear Ken,
        Still am getting this issue with I.E  in all version. Even if i use the Read Only property, i can select the content by double clicking the mouse and when i press enter the content will get cleared. Where as in Firefox When any button is clicked the cursor will be placed in the Text Area, when i press enter it will add enpty line breaks.
     
    Following is my requirement.

    1. I have disabled all the buttons on the Top except "My Saved Template". When i click "My Saved Template" the Templates will be listed in a Pop up window.
    2. When select any Template and press Insert button the Template will be placed in the Text Area.
    3. I Dont want the cursor to be focused on the Text Area Press Insert from the Pop-UP.
    4. When i use double click from the mouse the content should not be selected in Internet Explorer Browser.

    The Item 1 and 2 are working good currently. Am facing problem with Item 3 in Firefox, and Item 4 in Internet Explorer Browser.

    The attachments are taken from Internet Explorer Browser, which shows that how will the content gets cleared.

    Please get back me with Solution.

    Thanks,
    Rajmohan P
     
     
     
     
View as RSS news feed in XML