priya Avanigadda

priya Avanigadda

  • NA
  • 297
  • 147.6k

Can any one tell me what is the wrong in this code????

Feb 11 2015 5:06 AM
This is my sample code and am trying to checking the emptiness of the text box by user query but Jquery validation is not raising when am using the contentplaceholder,can any one check and tell me???
 
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Validation Example using JQuery</title>
<link rel="stylesheet" href="ValidationStyle.css" type="text/css" />
<script type="text/javascript" src="Scripts/jquery-1.3.2.js"></script>
<script type="text/javascript" src="Scripts/jquery-latest.js"></script>
<script type="text/javascript" src="Scripts/jquery.validate.js"></script>
<script type="text/javascript">
jQuery.validator.setDefaults({
debug: true,
success: "valid"
}); ;
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#form1").validate({
rules: {
<%=txtUserName.UniqueID %>: {minlength: 5,required: true},
<%=txtPassword.UniqueID %>: {minlength: 5,required: true},
<%=txtEmail.UniqueID %>: {required: true},
<%=txtURL.UniqueID %>: {required: true}
}, messages: {
<%=txtUserName.UniqueID %>:{required: "Plaese enter your name",minlength: "User name must be atleaet of 5 characters"},
<%=txtPassword.UniqueID %>:{required: "Plaese enter your password", minlength: "Password must be atleaet of 5 characters"},
<%=txtEmail.UniqueID %>:{ required: "Plaese enter your Email Id",},
<%=txtURL.UniqueID %>:{ required: "Plaese enter Website URL",}
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<br />
<br />
<br />
<br />
<br />
<table width="50%" cellpadding="2" cellspacing="4" style="border: solid 1px navy;
background-color: #d5d5d5;">
<tr>
<td colspan="2" align="center">
<b>Validation Example using JQuery</b>
</td>
</tr>
<tr>
<td align="right" width="75px">
User Name :
</td>
<td>
<asp:TextBox ID="txtUserName" runat="server" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right">
Password :
</td>
<td>
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right">
Email Id :
</td>
<td>
<asp:TextBox ID="txtEmail" runat="server" CssClass="email" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right">
URL :
</td>
<td>
<asp:TextBox ID="txtURL" runat="server" CssClass="url" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right">
&nbsp;
</td>
<td >
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</td>
</tr>
</table>
</form>
</body>
</html>
</asp:Content>
 

Answers (1)