简体   繁体   English

ASP.NET CustomValidator - 可以在客户端更改 ClientValidationFunction 吗?

[英]ASP.NET CustomValidator - is possible to change ClientValidationFunction on client side?

Is it possible to change ClientValidationFunction of ASP.NET CustomValidator on client side (from javascript)?是否可以在客户端(来自 javascript)更改 ASP.NET CustomValidator 的 ClientValidationFunction? I would like to select ClientValidationFunction dynamically in javascript, to perform conditional validation (ClientValidationFunction will be set to validator depending on actions, which user does on page).我想在 javascript 中动态 select ClientValidationFunction 执行条件验证(ClientValidationFunction 将根据用户在页面上执行的操作设置为验证器)。

Is this approach possible, and how?这种方法是否可行,如何实现?

Thanks谢谢

I'm not sure if this is possible, but I would call from my client validation function separate functions belonging to my specified condition.我不确定这是否可能,但我会从我的客户端验证 function 调用属于我指定条件的单独函数。

function myVal(sender, args)
{
   if ( [condition 1] ) return func_cond1( sender, args );
   else return func_cond2( sender, args );
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM