我創建了一個使用腳手架選項創建operation.I只是試圖加載到jquery ui Dialog.I能夠加載部分視圖(MVC4)加載我失去了MVC 4爲我生成的所有驗證。AJAX加載scafolded MVC 4局部視圖
是否有可能將部分視圖(腳手架)加載到jQuery對話框?
這裏是我已經使用了彈出
$(function() {
$("#CreateDialog").dialog({
autoOpen: false,
buttons: {
"Create": function() {
$(this).dialog("close");
}
},
dialogClass: "no-title",
hide: {
effect: "scale",
easing: "easeInBack"
},
show: {
effect: "scale",
easing: "easeOutBack"
}
});
});
function openModalPopUp() {
$.ajax({
type: 'GET',
url: '/Expense/CreatePartial',
cache: false,
success: function (result) {
$('#CreateDialog').html(result);
}
});
$("#CreateDialog").dialog("open");
}
和我的模型(樣本)代碼:
@model EFMvcWebRole.Models.ExpenseEntity
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>ExpenseEntity</legend>
<div class="editor-label">
@Html.LabelFor(model => model.ECValue)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.ECValue)
@Html.ValidationMessageFor(model => model.ECValue)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Category)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Category)
@Html.ValidationMessageFor(model => model.Category)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.TotalSalary)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.TotalSalary)
@Html.ValidationMessageFor(model => model.TotalSalary)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Remaining)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Remaining)
@Html.ValidationMessageFor(model => model.Remaining)
</div>
</fieldset>
你提交使用提交按鈕或任何按鈕的onclick事件用ajax發送數據的形式。 請向我展示您的提交代碼。 – 2014-09-15 05:04:55