How To jQuery Validation With ASP.Net

In this example, we will explain the basics used jQuery validation in ASP.Net Web Form. Using a library to do form validations can save much of your development time. The jQuery Form validation library is the most popular validation library and I think one of the easiest libraries to use in web forms.

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="jobnow_Default" %>

    <!DOCTYPE html>

    <html xmlns="">
    <head runat="server">
      <script src=""  type="text/javascript"></script>   
    <script src="" type="text/javascript"></script>  
        <script type="text/javascript">                
            $(document).ready(function () {  
                    rules: {  
                        <%=txtName.UniqueID %>:{  
                    messages: {  
                        <%=txtName.UniqueID %>:{  
                            required: "Name is required."  
        <form id="form1" runat="server">
            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
            <br />
            <br />
            <asp:Button ID="btnSubmit" runat="server" Text="Submit" />

Post a Comment