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

Re: Customise maxlength error message for different editors

  •  03-22-2011, 4:41 PM

    Re: Customise maxlength error message for different editors

    Dear casso,
     
    If you set MaxHTMLLength, all editors will return same error message, if you want to have different error message, you need have some customization, you can refer to the following snippet:
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <%@ Page language="c#" %>
    <html>
    <head>
    </head>
    <body>
        <form runat="server" id="Form1">
            <div class="demo">        
                <CE:Editor id="Editor1" Height="200" OnPostBackCommand="Editor1_PostBackCommand"
                    ThemeType="OfficeXP" AutoConfigure="Minimal" runat="server">
                </CE:Editor><br />
                <CE:Editor id="Editor2" Height="200" runat="server" ThemeType="OfficeXP" AutoConfigure="Minimal">
                </CE:Editor>
        </form>
    </body>
    </html>
    <script runat="server">
     void Page_Load(object sender, System.EventArgs e)
      {
       
      }
     private void Editor1_PostBackCommand(object sender, System.Web.UI.WebControls.CommandEventArgs e)
     {
            if(string.Compare(((CuteEditor.Editor)sender).ClientID,"ce_editor1_id",true)==0)
            {
              string text = Editor1.PlainText;
              if (text.Length > 10)
              {
                  string myScript = "alert('You are using editor1 and you input  "+text+";You can not input more than 20 characters');";
                  Page.ClientScript.RegisterStartupScript(this.GetType(),
                  "MyScript", myScript, true);
              }
            }  
     }
    </script>
    Thank you for asking
    Eric@cutesoft.net


     

View Complete Thread
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.