Priya Avanigadda

Priya Avanigadda

  • NA
  • 44
  • 16.8k

Jquery Validation with asp.net master page??

Feb 16 2015 12:44 AM
I don't what is the error in this code, Jquery validation is not working with master page,can any one help me cuz am not sure where I'm going wrong
 
<%@ Page Title="" Language="C#" MasterPageFile="~/CareerMasterPage.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript">
$(document).ready(function() {
$("#form1").validate({
rules: {
<%=txtName.ClientID%>: {
minlength: 2,
required: true
},
<%=txtEmail.ClientID%>: {
required: true,
email:true
}
}, messages: {
<%=txtName.ClientID%>:{
required: "* Required Field *",
minlength: "* Please enter atleast 2 characters *"
}
}
});
});
</script>
<form id="form1" runat="server">
Name: <asp:TextBox ID="txtName" MaxLength="30" runat="server" /><br />
Email: <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox><br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</form>
</asp:Content>
 And  I tried to with ClientModeID="Static" but no use....cuz this error I wasted more time,so can any one help me
 

Answers (2)