I want to do exactly the same thing that in this question : http://stackoverflow.com/questions/1249709/jquery-validation-remote-validation-not-working
The only thing that change is that I'm using Asp.Net WebForm instead of Asp.Net MVC. So, the solution proposed in this post doesn't work for me...
UPDATE
From Jeff comment, here's my new try:
$("#mainForm").validate(
{
rules:
{
UserName:
{
required: true
,remote: "IsValidField"
}
,messages:
{
UserName:
{
remote: "UserName has already been choosen. Please choose another one"
}
}
}
c#
public String IsValidField()
{
String the_field = Request["Field_To_Test"];
JavaScriptSerializer serializer = new JavaScriptSerializer();
if (the_field == another_value)
return serializer.Serialize(true);
else
return serializer.Serialize(true);
}
If I put a breakpoint the method is never call...