当前位置: 代码迷 >> JavaScript >> jquery 验证插件 在asp.net的母版页下用不了
  详细解决方案

jquery 验证插件 在asp.net的母版页下用不了

热度:78   发布时间:2012-05-11 12:55:37.0
jquery 验证插件 在asp.net的母版页下用不了 求助
这一个是没有在模板页下的,没有问题 可以用

C# code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="CAI.SHOP.Web.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<script src="js/jquery-1.6.min.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine-zh_CN.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript"></script>
<link href="css/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
<script>
    jQuery(document).ready(function () {
        jQuery("#form1").validationEngine();
    });
</script>
<form id="form1" runat="server">
<br />
<br />
<input class="validate[required] text-input" type="text" id="req" />
</form>
</html>



这个是母版页下的 不起作用了

母版页:
C# code
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="CAI.SHOP.Web.Site1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="js/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="js/jquery.validationEngine-zh_CN.js" type="text/javascript"></script>
    <script src="js/jquery.validationEngine.js" type="text/javascript"></script>
    <link href="css/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
    <script>
        jQuery(document).ready(function () {
            jQuery("#form1").validationEngine();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>


webform:
C# code
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
    CodeBehind="WebForm2.aspx.cs" Inherits="CAI.SHOP.Web.WebForm2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <br />
    <br />
    <input class="validate[required] text-input" type="text" id="req" />
</asp:Content>


------解决方案--------------------
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="CAI.SHOP.Web.WebForm2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  相关解决方案