0

我在我的网页中使用富文本框。我能够成功添加它。但我想验证它只包含大约 150 个单词。以下是我的代码。

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:TextBox ID="txtActionTaken" TextMode="MultiLine" Columns="60" Rows="8" runat="server"/>
<asp:HtmlEditorExtender ID="htmlActionTaken" runat="server">                                                        </asp:HtmlEditorExtender>
<script type="text/javascript" language="javascript">
        function Validate(sender, args) {
        if (args.Value.length > 150) {
            args.IsValid = false;
            return;
        }
      }
</script>
<asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtActionTaken"
ErrorMessage="ComplaintDescription Should not exceed 100 words!!" OnServerValidate="CustomValidator1_ServerValidate1"
SetFocusOnError="True" ClientValidationFunction="Validate()" 
Display="Dynamic"></asp:CustomValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtActionTaken"
ErrorMessage="ComplaintDescription should not be empty!!" 
Display="Dynamic"></asp:RequiredFieldValidator>

此代码将 HTMLException 抛出为未找到源代码。请帮我修复它。

4

0 回答 0