我是 mvc 的新手。我必须显示一个模型对话框..但它显示这样的错误..代码应该如下所示..
在视野中
<div class="demo">
<div id="dialog-modal" title="Basic dialog">
</div>
<button id="opener">Open Dialog</button>
</div>
<script type="text/javascript">
$(function () {
$('#dialog').dialog({
autoOpen: false,
width: 400,
resizable: false,
title: 'hi there',
modal: true,
buttons: {
"Close": function () {
$(this).dialog("close");
}
}
});
$('#opener').click(function () {
//Load the CreateAlbumPartial action which will return
// the partial view _CreateAlbumPartial
$('#dialog').load('@Url.Action("PartialTest")',
function (response, status, xhr) {
$('#dialog').dialog('open');
});
});
});
</script>
在控制器中
//[HttpGet]
public PartialViewResult Test()
{
//List<string> category_lst = new List<string>();
//category_lst = (from r in db.dept select r.dname).ToList();
return PartialView(db.dept.ToList());
}