Re: Using CuteEditor as a Simple TextBox Form Field

  •  07-28-2006, 2:40 AM

    Re: Using CuteEditor as a Simple TextBox Form Field

    Jon,
     
    Please check this example:
     
     
    The source code of the above example is as following:
     
     
    <%@ Page Language="C#"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
        <head>
      <title>Render AS TextBox</title>
      <link rel="stylesheet" href="../example.css" type="text/css" />
      <script language="JavaScript" type="text/javascript" >
       
       function CE_attachEvent()
       {
        // get the cute editor instance
        var editor1 = document.getElementById('<%=Editor1.ClientID%>');
        
        //Get the editor content 
        var editdoc=editor1.GetDocument();
        // attach Event
        if(editdoc.attachEvent)
         editdoc.attachEvent('onkeypress',checkkey);
        else if(editdoc.addEventListener)
         editdoc.addEventListener('keypress',checkkey,true);
       }   
       
       function CE_detachEvent()
       {
        // get the cute editor instance
        var editor1 = document.getElementById('<%=Editor1.ClientID%>');
        
        //Get the editor content 
        var editdoc=editor1.GetDocument();
        // detach Event
        if(editdoc.detachEvent)
         editdoc.detachEvent('onkeypress',checkkey);
        else if(editdoc.removeEventListener)
         editdoc.removeEventListener('keypress',checkkey,true);
       }
       
       function checkkey(event)
       {
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if(keyCode==13){
         event.returnValue=false;
         event.cancel = true;
        }
       }  
        
      </script>
      </head>
      <body>
       <form runat="server">
        <CE:Editor id="Editor1" AutoConfigure="Minimal" runat="server" Height="60" ShowBottomBar="false"></CE:Editor>
        <br/><br/>
        <INPUT type=button value="Single Line" onclick="CE_attachEvent()">
        <INPUT type=button value="Multiple Line" onclick="CE_detachEvent()">
       </form>
      </body>
     </html>
      <script runat="server">
       void Page_Load(object sender, System.EventArgs e)
       {
        if (!IsPostBack)
        {
         Editor1.Text = "Type here...";
        }
       
       }
      </script> 
     
    Please check this example. I will answer your other questions based on your response.
     
    Keep me posted
     
     

    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 Complete Thread