我怎么可以调用javascript函数时ASP.net验证摘要充满 [英] how can i call a javascript function when an ASP.net validation summary is filled
问题描述
我有一个在的ValidationSummary我的网页。我想调用javascript函数在ValidationSummary充满后。我怎样才能做到这一点?
i have a validationSummary in my page. i want to call a javascript function after the validationSummary is filled. how can i achieve this?
我觉得我应该添加在code的属性后面,但我无法弄清楚什么是属性的关键。
i think i should add an attribute in the code behind, but i can't figure out what is the attribute's key.
任何帮助吗?
推荐答案
您将要调用JavaScript函数 Page_ClientValidate()
启动有线连接到ASP.NET验证您的页面控件。一旦被调用, Page_IsValid
布尔值将被设置正确。
You will want to call the javascript function Page_ClientValidate()
to initiate the ASP.NET validation wired to your page controls. Once this is called, the Page_IsValid
boolean value will be properly set.
下面是我如何使用它的一个例子。如果ASP.NET验证是成功的,停用的按钮,否则启用按钮遗体和验证摘要显示给用户。在的OnClientClick
是从ASP:Button控件
Here is an example of how I am using it. If ASP.NET validation is successful, I disable the button, otherwise the button remains enabled and the validation summary is displayed to the user. The OnClientClick
is from a ASP:Button control.
OnClientClick="javascript:Page_ClientValidate(); if (Page_IsValid==true) { this.disabled=true; }"
这篇关于我怎么可以调用javascript函数时ASP.net验证摘要充满的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!