自定义验证器不起作用

自定义验证器不起作用

本文介绍了ASP.NET:自定义验证器不起作用!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我似乎遇到了一个非常普遍的问题,关于这个问题,我已经在Google上搜索了多个小时,但是找不到解决方案...

我在ASP.NET中的Custom-Validator无法正常工作!

Hello everybody!

I seem to have a very common problem, about which I have Googled for many hours now, but could not find a solution...

My Custom-Validator in ASP.NET just won''t work!

<asp:CustomValidator
    id="cusvalISBN"
    runat="server"
    ControlToValidate="txtISBN"
    Display="Dynamic"
    ErrorMessage="This ISBN already exists"
    OnServerValidate="isbnDuplication"
    ValidateEmptyText="True">
</asp:CustomValidator>



我的C#代码中的函数从未被触发过.我已经尝试调试,并且所有内容,即使"cusvalISBN.Validate()"也不会调用该函数...

我已经将此验证器与Requiredfieldvalidator结合使用.因此,空文本是不可能的!奇怪的是:几天前我在另一个页面上已经遇到了相同的问题……几个小时后,它突然起作用了.我可以重现为使其起作用而进行的更改.新代码仅被复制和粘贴,但无法正常工作:-(

有什么想法吗?



The function in my C# code is just NEVER being fired. I have tried debugging and everything, even "cusvalISBN.Validate()" does NOT call the function...

I am already using this validator in combination with a Requiredfieldvalidator. So empty text is not possible! The weird thing is: I already had the same problem a few days ago on another page... after some hours, it suddenly worked. I could reproduce the change I had done to make it working. The new code is just copied and pasted and yet, it isn''t working :-(

Any ideas??

推荐答案



这篇关于ASP.NET:自定义验证器不起作用!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 15:09