0

I want to know the best simple tutorial for asp.net web form validation with Jquery (Ajax) not plugin.I want to develop the ajax form with jquery.

I have a registeration form.When I submit the form,I want to call asp.net validation method by jquery $.ajax . I want to validate the form field with server side validation. I don't want to use jquery form validation plugin.

1
  • Could you provide a little more detail as to what exactly your trying to do? Do you want serverside or client side validation? When you say "with Jquery (Ajax) not plugin" do you mean you dont want to use a Jquery plugin for it? Commented Mar 22, 2011 at 4:26

1 Answer 1

1

If you want to validate on server-side you should use, for example, asp.net web-service. If you want to create it just add .asmx file in your solution.

/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{

    [WebMethod]
    public bool ValidateDate(string value)
    {
        bool isValide =true;
        //Validation code
        return isValide
    }
}

After creating web-service you can send request to it, using $.ajax

for example, like this (I like to use JSON): where webserviceName is name of your .asmx file and function is name of web-service method you need.

 $.ajax(
{
    type: "POST",
    url: webserviceName + functionName,
    contentType: "application/x-www-form-urlencoded; windows-1251;",
    dataType: json,
    data: parameters,
    success: callbackFunction,
    error: errorCallbackFunction
});

See example on this page - http://msdn.microsoft.com/en-us/library/bb515101.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.