For validating login field (at register form) I use customValidator
<asp:CustomValidator id="uniqueLoginValidator" class="validator" runat="server" ControlToValidate="tbUserName" ErrorMessage="Login duplicate" ClientValidationFunction="LoginValidate"/>
For validate login I need consume wcf, so decide use web-methods
<script type="text/javascript">
function LoginValidate(oSrc, args) {
var login = $(".loginField").val();
PageMethods.ValidateLogin(login,OnRequestComplete, OnRequestError);
return;
}
function OnRequestComplete(result, userContext, methodName) {
return;
}
function OnRequestError(error, userContext, methodName) {
if (error != null) {
alert(error.get_message());
}
</script>
My web-method like:
[WebMethod]
public static bool ValidateLogin(string login)
{
//wcf consuming
return res;
}
For successfull validating I should setup args at ClientValidationFunction, but I get result validation only at callBack. So how can I setup args for validation work.