好的,所以Ajax.ActionLink不会打开弹出窗口。
我的_Layout.cshtml包含:
<script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
我的Index.cshtml:
@Ajax.ActionLink("Contact", "Contact", new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "result", InsertionMode = InsertionMode.Replace, OnSuccess = "openPopup" })
<div id="result" style="display:none;"></div>
<script type="text/javascript">
$(document).ready(function () {
$("#result").dialog({
autoOpen: false,
title: 'Title',
width: 500,
height: 'auto',
modal: true
});
});
function openPopup() {
$("#result").dialog("open");
}
</script>
我的控制员:
public PartialViewResult Contact()
{
ViewBag.Message = "Your contact page.";
return PartialView();
}