CustomValidator ClientJavaScript更換訊息

摘要:CustomValidator ClientJavaScript更換訊息

Validator

                <asp:CustomValidator ID="cvValidator" runat ="server" Display="None" 
ValidationGroup="Save" ClientValidationFunction ="ValidData" ></asp:CustomValidator>

 

JavaScript

 

        <script language='javascript' type='text/javascript'>
            function ValidAdjustment(source, args) {
                source.errormessage = "錯誤訊息";
                args.IsValid = false;
            }
        </script>

ValidationSummary

<asp:ValidationSummary ID="ValidationSummary1" ValidationGroup="Save" runat="server"
                                ShowMessageBox="true" ShowSummary="false"  />

 Button
 

<asp:Button ID="btnOK" runat="server" SkinID="BTN_OK" ValidationGroup="Save" OnClick="btnOK_Click" />