<%@ Page Language="C#"%>
<% User us = new User();
bool result;
if (Request["ctl00$ContentPlaceHolder1$txtusername"] != null)
{
result = us.checkUserAvailability(Request["ctl00$ContentPlaceHolder1$txtusername"].ToString(), "username");
if (result)
{
Response.Write("true");
}
else
Response.Write("false");
}
else if (Request["ctl00$ContentPlaceHolder1$txtemail"] != null)
{
result = us.checkUserAvailability(Request["ctl00$ContentPlaceHolder1$txtemail"].ToString(), "email");
if (result)
{
Response.Write("true");
}
else
Response.Write("false");
}
%>
source code :
<script type="text/javascript" language="javascript">
$().ready(function() {
$("#aspnetForm").validate({
rules: {
ctl00$ContentPlaceHolder1$txtfirstname: {
required: true
},
ctl00$ContentPlaceHolder1$txtlastname: {
required: true
},
ctl00$ContentPlaceHolder1$txtpassword: { required: true, minlength: 5 },
ctl00$ContentPlaceHolder1$txtemail: {
required: true,
remote: "Controller/checkUserAvail.aspx",
email: true
},
ctl00$ContentPlaceHolder1$txtaddress1: { required: true }
},
messages: {
ctl00$ContentPlaceHolder1$txtfirstname: {
required: "<br/>Please enter First Name"
},
ctl00$ContentPlaceHolder1$txtlastname: {
required: "<br/>Please enter Last Name"
},
ctl00$ContentPlaceHolder1$txtpassword: {
required: "<br/>Please enter a password",
minlength: "<br/>Minimum password length is 5 characters"
},
ctl00$ContentPlaceHolder1$txtemail: {
required: "<br/>Please enter a email",
email: "<br/>Please enter a valid email",
remote: jQuery.format("<br/>Email address is already in use")
},
ctl00$ContentPlaceHolder1$txtaddress1: { required: "<br/>Please enter address"
}
}
});
});
</script>
Thank
Rajesh singh
No comments :
Post a Comment