Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/467.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过javascript自定义验证程序错误文本?_Javascript_Asp.net_Asp.net 2.0 - Fatal编程技术网

通过javascript自定义验证程序错误文本?

通过javascript自定义验证程序错误文本?,javascript,asp.net,asp.net-2.0,Javascript,Asp.net,Asp.net 2.0,我想通过客户端javascript设置ASP.net自定义验证程序错误参数文本。如何通过“我的函数”中的sender、args参数访问它?只需在CustomValidator定义的属性中定义回调方法: <asp:CustomValidator id="CustomValidator1" ... ClientValidationFunction="ClientValidationFunction" /> 您只需在CustomValidator定义的属性中定义回调方法:

我想通过客户端javascript设置ASP.net自定义验证程序错误参数文本。如何通过“我的函数”中的sender、args参数访问它?

只需在CustomValidator定义的属性中定义回调方法:

<asp:CustomValidator id="CustomValidator1" 
   ...
   ClientValidationFunction="ClientValidationFunction" />

您只需在CustomValidator定义的属性中定义回调方法:

<asp:CustomValidator id="CustomValidator1" 
   ...
   ClientValidationFunction="ClientValidationFunction" />
这对我很有用:

var clientValidationFunction = function(sender, args) {
    sender.textContent = sender.innerText = sender.innerHTML = "My new error text";
    // etc...
};
我只是查看了sender对象,并用新的错误字符串替换了当前出现的所有错误字符串。

这对我很有效:

var clientValidationFunction = function(sender, args) {
    sender.textContent = sender.innerText = sender.innerHTML = "My new error text";
    // etc...
};

我刚刚查看了sender对象,并用新的错误字符串替换了当前出现的所有错误字符串。

谢谢Dexter,我想知道如何通过javascript设置验证器的错误消息参数。您的示例中的“源”是什么?抱歉-应该是
sender
谢谢Dexter,我想知道如何通过javascript设置验证器的错误消息参数。您的示例中的“源”是什么?抱歉-它应该是
sender
另请参见