自定义控件验证 [英] custom control validation

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

问题描述

大家好,我有一个自定义控件,它由AJAX.NET日历扩展程序和一个文本框组成,并且我在该控件上有一个自定义验证程序,该验证程序使用javascript验证了该控件,并且在我正在使用的自定义验证程序上calloutvalidator扩展程序:

Hi guys, i have a custom control, which is made up of the AJAX.NET calendar extendar and a textbox, and i have a custom validator on that control that validates the control using javascript and on the custom validator i am using a calloutvalidator extender:

function doStartDateCheck(source, args)
    {
        var arg = document.getElementById('<%=calStart.FindControl("txtCalender").ClientID %>').value;
        if (arg == "")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }




但是一旦尝试验证我就会收到此错误:




but as soon as it tries to validate i get this error:

Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: id



你们在帮助方面所做的任何事情,在此先感谢您!



Anything that you guys could do to help would be much appreciated thanks in advance!

推荐答案

最好的猜测是calStart.FindControl("txtCalender").ClientID返回null-检查calStart.FindControl函数并查看它在做什么.
Best guess is that calStart.FindControl("txtCalender").ClientID is returning null - check the calStart.FindControl function and see what it is doing.


我怀疑上面的错误与您共享的代码示例有什么关系.

错误告诉您Javascript中有一些名为"id"的变量是未定义的,但在运行时仍在使用.找到它并解决.使用JavaScript调试来跟踪它,并查看错误的确切位置.
I doubt the above error has to do anything with the code sample you have shared.

Error is telling you that there is some variable named as "id" in your Javascript that is undefined and yet being used at runtime. Find it and resolve that. Use JavaScript debugging to track it down and see where exactly the error lies.


这篇关于自定义控件验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆