【发布时间】:2011-07-29 00:31:17
【问题描述】:
Tablesorter 不适用于 Visual Studio 2010 上的 MVC3 Web 应用程序?
重现问题:
- 打开 Visual Studio 2010
- 创建一个新的 ASP.NET MVC 3 Web 应用程序
-
将 Views/Shared/_Layout.cshtml 替换为:
<!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> @* This doesn't work and I don't know why *@ <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.tablesorter.min.js")" type="text/javascript"></script> @*This works*@ @*<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> *@ </head> <body> <div class="page"> <div id="main"> @RenderBody() </div> </div> </body> </html> -
将 Views/Home/Index.html 替换为:
<h2>debug jquery Kano</h2> <p> testing </p> <table id="theTable" class="tablesorter"> <thead> <tr><th>Tic</th><th>Tac</th><th>Toe</th></tr> </thead> <tbody> <tr><td>o</td><td>o</td><td>x</td></tr> <tr><td>x</td><td>o</td><td>o</td></tr> <tr><td>o</td><td>x</td><td>x</td></tr> </tbody> </table> <script type="text/javascript"> // $(function () { // alert("$: jQuery found!"); // }); $(document).ready(function () { $("#theTable").tablesorter(); }); </script> 从http://tablesorter.com下载jquery.tablesorter.min.js并放入/Scripts目录。
- 构建并运行应用程序。
如您所见,Index.cshtml 中的 tablesorter 调用似乎没有成功执行。
感谢您的帮助!
干杯, 凯文
【问题讨论】: