Page_ClientValidate出现问题

问题描述:

我的应用程序是在VB.net中构建的。我动态添加文本框和RequiredFieldValidator。验证组的名称是vgFormVals。



在我的页面上,我执行此功能



如果(Page_ClientValidate(''vgFormVals''))返回false;



没有填写必填字段。该函数无法返回false。



我在页面上也有树视图。如果我首先在树视图中选择一个节点,然后运行上面的函数,它就可以工作。



提前致谢。

My application is built in VB.net. I dynamically add textboxes and RequiredFieldValidator. The name of the validation group is vgFormVals.

On my page, i execute this function

if (Page_ClientValidate(''vgFormVals'')) return false;

without ever filling in the required fields. The function fails to return false.

I also have a treeview on the page. If I select a node in the treeview first and then run the function above, it works.

Thanks in advance.

发现我的问题。我的一些必需的验证器字段在id中有空格。例如id =rfv somevalue。解决这个问题解决了我的问题,但没有解释为什么它适用于我上面提到的其他场景。
Found my issue. Some of my required validator fields had white space in the id. For example id = "rfv somevalue". Fixing this fixed my problem, but doesnt explain why it works in the other scenario I mentioned above.