在Ajax updatepanel中验证 - 无法正常工作 [英] Validation in Ajax updatepanel - not working

查看:68
本文介绍了在Ajax updatepanel中验证 - 无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好......


有人可以指导我这个吗?


我有一个面板(比如,panel1)在另一个里面面板(例如,外部面板)?。只有在外部面板中选中复选框时,面板1才可见。我正在使用ajax更新面板来执行此操作。


现在我在panel1中有很多文本框。我必须对所有方框进行验证。


我试图通过在2个盒子上进行验证来测试这个,这在我的本地机器上工作正常。当我在服务器上放置相同的逻辑时,它没有。当然,与服务器上的页面相比,本地计算机上的页面文本框更少。但我不明白为什么相同的逻辑在我的本地机器上工作,并且在服务器上不起作用。我确实试过放一个验证组,但没有用....


服务器上的页面很长,而且它还有一个验证码控件?...我试着不在一个有验证的文本框中输入文本,然后点击提交?它会将我重定向到另一个页面而不提示验证错误。


有人可以告诉我我可能是什么原因?提前谢谢?。

Hello there...

can somebody guide me on this?

I have a panel (say, panel1) inside another panel (say, outer-panel)?.The panel1 is visible only when a checkbox is checked in the outer-panel. I am using ajax update panel to do this.

Now I have many text boxes in the panel1. I have to put a validation on all the boxes.

I tried to test this by putting validation on 2 boxes and this works fine on my local machine. When I put the same logic on the server, it does not. Of course the page on my local machine has fewer text boxes compared to the page on server. But I do not understand why the same logic works on my local machine and does not work on the server. I did try to put a validation group, but of no use....

The page on the sever is a very long one and also it has a captcha control?.. when ever I try not to enter text in one the text boxes which has validation and then hit submit?it redirects me to another page with out prompting for the validation error.

Can somebody please tell me what could be the reason?thanks in advance?.

推荐答案

您是否使用ScriptManager注册了验证JavaScript?


如果你没有遇到只要没有对服务器进行异步回发就会执行JavaScript验证的问题....在发生异步回发之后,之前正在运行的JavaScript将会不再工作了。这就是ScriptManager存在的原因之一,因此您可以注册JavaScript,以便在每次异步加载页面时将其发送到以保持脚本正常工作。


-Frinny
Did you register your validation JavaScript with the ScriptManager?

If you didn''t you''re going to run into problems where the JavaScript validation will execute as long as no asynchronous postback has been made to the server....after an asynchronous postback has happened then the previously working JavaScript will no longer work. That is one of the reasons why the ScriptManager exists, so that you can register your JavaScript in order for it to be sent to every time the page is asynchronously loaded to keep scripts working.

-Frinny


谢谢你的回复..我确实用脚本管理员注册了脚本......但是我还有这个问题......
thank you for your response..I did register the script with the scriptmanager...but still I have this problem...


你是如何注册脚本的?

(请发布使用ScriptManager注册脚本的代码)


-Frinny
How did you register the script?
(Please post the code that registers the script with the ScriptManager)

-Frinny

这篇关于在Ajax updatepanel中验证 - 无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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