jquery验证引擎+ ajaxcall +检查用户存在+ asp.net [英] jquery validation engine + ajaxcall + check user existence + asp.net

查看:78
本文介绍了jquery验证引擎+ ajaxcall +检查用户存在+ asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好专家,



请帮助我解决这个问题:



我创造了一个aspx表单。



我正在使用JQuery验证引擎(http://www.position-relative.net/creation/formValidator/)进行验证。



现在,我想通知用户数据库中已使用的id是否已经存在相同的红色气球错误提示(jquery验证引擎的默认值)。



我搜索谷歌并获得了一些提示,但我对如何将参数传递给ajaxcall中涉及的web方法感到困惑。



这是github网站(http://posabsolute.github.io/jQuery-Validation-Engine/#options/ajaxformvalidation)中给出的代码:



Hello experts,

Kindly help me in solving this problem:

I have created an aspx form.

I am Using JQuery validation engine (http://www.position-relative.net/creation/formValidator/) for validation.

Now, I want to notify the user whether the used id already exists in the database with the same red balloon error tip (default for jquery validation engine).

I searched google and got some tips but I am confused about how to pass arguments to the webmethod involved in the ajaxcall.

This is the code given in github site (http://posabsolute.github.io/jQuery-Validation-Engine/#options/ajaxformvalidation):

"ajaxUserCall": {
    "url": "~/Page.aspx/ajaxValidateFieldUser",
    "extraData": "name=eric",
    "extraDataDynamic": ['#user_id', '#user_email'],
    "alertText": "* This user is already taken",
    "alertTextOk": "All good!",
    "alertTextLoad": "* Validating, please wait"
}





我已通过以下方式了解它。如果我错了,请纠正我。



1)我在'jquery.validationEngine.js'文件中包含了这段代码。

2)我在.Page.aspx'中创建了webmethod'ajaxValidateFieldUser'。它如下:





I have understood it in the following way. Please correct me if I am wrong.

1) I have included this block of code in 'jquery.validationEngine.js' file.
2) I have created webmethod 'ajaxValidateFieldUser' in .Page.aspx'. It is as follows:

[WebMethod]
public static bool IsUserAvailable(string username)
{
    if (record does not exist in table) // do not worry about this part of code. It is just for example
    	return true;
    else
    	return false;
}





3)在userId文本框中,我添加了类'validate [ajaxValidateFieldUser]'。



4)当然,我添加了正确的jquery文件,以便JQuery ValidationEngine的其他验证工作正常。



它无法正常工作。我不确定如何将用户名参数(这是使用的id文本框的输入)传递给web方法。



请帮助我完成这项工作。请给出你的回复代码和理论。



提前谢谢



3) In the userId textbox, I have added the class 'validate[ajaxValidateFieldUser]'.

4) Of course, I have added proper jquery files so that the other validations of JQuery ValidationEngine are working properly.

It is not working. I am not sure how to pass username parameter (which is the input of used id textbox) to the webmethod.

Please help me in getting this work. Please give your reply with codes and theory.

Thanks in advance

推荐答案

你可以参考下面的内容这解释相同。



http:/ /techbrij.com/username-check-asp-net-jquery-validation [ ^ ]



希望这有帮助
You can refer the below which explains the same .

http://techbrij.com/username-check-asp-net-jquery-validation[^]

Hope this helps


这篇关于jquery验证引擎+ ajaxcall +检查用户存在+ asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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