Re: MaxHTMLLength validation occurs even when the button clicked has CausesValidation=false

  •  09-02-2011, 9:53 AM

    Re: MaxHTMLLength validation occurs even when the button clicked has CausesValidation=false

    Hi ceblanda,
     
    Please try the examle below
     
    <%@ Page Language="C#" EnableViewState="false" %>

    <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>GetPlainText</title>
    </head>

    <script runat="server">
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            label1.Text = "postback!";
        }
    </script>

    <body>
        <form id="form1" runat="server">
            <CE:Editor ID="editor1" runat="server" MaxTextLength="1">
            </CE:Editor>
            <asp:Button ID="btnSave" runat="server" Text="save" />
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="test()" OnClick="btnCancel_Click" />
            <asp:Label ID="label1" runat="server"></asp:Label>
        </form>
    </body>
    </html>

    <script>
    function test()
    {
        var editor1=document.getElementById("<%= editor1.ClientID %>");
       editor1.setHTML("");
    }
    </script>
     
    Regards,
     
    Ken
View Complete Thread