自定义验证器Web服务调用

自定义验证器Web服务调用

问题描述:

大家好,
我在使用自定义验证程序客户端验证时遇到了麻烦.请帮忙..

我想有一个进度条,用于同步自定义验证程序调用.这可行,但是我需要进度条.有可能吗?

在验证程序返回之前,我尝试了异步Web服务调用-submit按钮,转到下一步-使用Icallbackeventhandler ..

谢谢

smp

Hi All,
I am having trouble with custom validator client side validation. Please help..

I would like to have a Progress bar for synchronous custom validator call. This works but I need progress bar. Is it possible?

I tried a asynchronous web service call -submit button gooes to the next step before the validator returns-Using Icallbackeventhandler..

Thanking you,

smp

您可能想要做的事,但是我不确定使用ASP.NET自定义验证器是最简单的方法.如果此自定义验证仅在一页或两页上,那么我将使用回调和一些JQuery代码手动进行验证.

将一个单击事件处理程序添加到您的提交按钮(以及应该引起验证的任何其他按钮)上,如下所示:
What you want to do is possible, but I''m not sure using a ASP.NET custom validator is the easiest way to go. If this custom validation is only on one or two pages, I''d just do the validation manually using a callback and some JQuery code.

Add a click event handler to your submit button (and any other button that should cause validation) that looks something like this:


(''.buttonsThatCauseValidation'').live("click", function(event) { if (event.button != 2) { // Proceed if this is not a right-click // Display your progress bar/spinner/modal UI here. // Example using the JQuery BlockUI plugin:
(''.buttonsThatCauseValidation'').live("click", function(event) { if (event.button != 2) { // Proceed if this is not a right-click // Display your progress bar/spinner/modal UI here. // Example using the JQuery BlockUI plugin:


.blockUI({ message: ''<h1>Please wait while we begin processing your form.</h1>'', css: { padding: ''10px'' } }); <Insert CallbackReference Here>; return false; // Return false here to prevent the button from actually doing the postback or submitting the form. } return true; // Return true here to allow the default action to occur. });
.blockUI({ message: ''<h1>Please wait while we begin processing your form.</h1>'', css: { padding: ''10px'' } }); <Insert CallbackReference Here>; return false; // Return false here to prevent the button from actually doing the postback or submitting the form. } return true; // Return true here to allow the default action to occur. });



然后,在客户端回调处理程序中,检查您的验证结果,并显示错误消息或继续执行回发/提交操作.



Then in your client-side callback handler you check your validation result and either show an error message or proceed with the postback/submit operation.

function GetValidationCallbackResult(result) {
    // Hide your progress bar/spinner/modal UI here.
    // Example using the JQuery BlockUI plugin: