我已升级到VS.NET 2013,现在,每次我开始在IIS中调试ASP.NET MVC4应用程序时,如何创建__vwd/js/artery,这个脚本会干扰我的RequireJS设置并且它会崩溃jQuery参考.
有谁知道我怎么能摆脱这个脚本?
__vwd/JS /动脉
window.vwdTempJQuery = window.jQuery = window.$;
window.jQuery = window.$ = null;
window.vwdTempJSON = window.JSON;
*! jQuery v1.8.2 jquery.com | jquery.org/license */
.....
// Restore original jQuery references.
window.jQuery = window.$ = window.vwdTempJQuery;
window.vwdTempJQuery = null;
// Restore original JSON.
if (window.JSON !== window.vwdTempJSON)
window.JSON = window.vwdTempJSON;
....
Run Code Online (Sandbox Code Playgroud)
更新:我用Razor HTML 5创建了一个新的MVC 3项目,然后我在JQuery 1.6上使用NuGet更新了项目,并且验证插件不再起作用,它每次都会回发并返回错误服务器的消息.我认为使用JQuery 1.6打破了验证插件
我有一个MVC 3应用程序,它使用Jquery UI对话框(从包含表单的部分视图加载),以便通过ajax向服务器提交信息.我想在执行ajax发布之前在客户端触发我的表单验证.在Firefox和IE9上运行正常,在IE7和IE8中,form.validate()始终返回true.
这是附加到我的提交按钮的js代码:
var wizard = $("#wizard"); //div that holds the modal dialog
var myform = $("#wizard form");
var submitFunction = function (e) {
e.preventDefault(); //no postback
myform.validate();
if (myform.valid()) {
$(this).attr("disabled", "disabled");
submited = true;
$.post(
"SuperAdmin/CreateEditController",
$(this).serialize(),
function (data) {
if (data.Success) {
wizard.dialog('destroy');
}
else {
wizard.html(data.Html);
}
},
"json"
); //end json post
}
};
myform.submit(submitFunction);
Run Code Online (Sandbox Code Playgroud)
我使用以下包括:
<script src="@Url.Content("~/Scripts/jquery-1.6.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script> …Run Code Online (Sandbox Code Playgroud) 我有以下结构:
模型
public class EventEntry : LogEntry
{
public EventType Type { get; set; }
public string Source { get; set; }
}
public enum EventType : int
{
Information = 1,
Warning = 2,
Error = 3
}
Run Code Online (Sandbox Code Playgroud)
视图
<div id="grid">
@{
var grid = new WebGrid(canPage: true, rowsPerPage: Ctrl.PageSize, canSort: true, ajaxUpdateContainerId: "grid");
grid.Bind(Model.Events, rowCount: Model.TotalRecords, autoSortAndPage: false);
grid.Pager(WebGridPagerModes.All);
@grid.GetHtml(htmlAttributes: new { id="grid" },
columns: grid.Columns(
grid.Column("Type"),
grid.Column("Source"));
}
</div>
Run Code Online (Sandbox Code Playgroud)
调节器
public ActionResult Index(int? page, string sort, string …Run Code Online (Sandbox Code Playgroud)