我在视图中有以下代码:
@model IEnumerable<soundyladder.Service.Models.Profile>
@{
ViewBag.Title = "Profile Login";
Layout = "/Views/Shared/_Layout2.cshtml";
}
<style>
#tableTest tr:hover {
cursor: pointer;
}
</style>
<div class="centering col-lg-6 logged_in_mainboxes">
<h3>Profiles</h3>
<table class="table table-striped" id="tableTest" style="margin-top: 15px;">
@foreach (var m in Model)
{
<tr>
<td>@Ajax.ActionLink(m.Name, "Edit", "ProfileLogin", null, new AjaxOptions()
{
HttpMethod = "Post",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "result", // <-- DOM element ID to update
// <-- Replace the content of DOM element
// <-- HTTP method(Post/Get)
})</td>
</tr>
}
</table>
<div id="result">
</div>
</div>
这是我的控制器:
public ActionResult Edit()
{
return PartialView("_EditProfile");
}
Layout.cshtml:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
<link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Content/select2.min.css" rel="stylesheet" type="text/css" />
<script src="~/Scripts/modernizr-2.6.2.js"></script>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
<script src="~/Scripts/select2.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="centering col-lg-6" style="padding: 0;">
@Html.ActionLink("", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
</div>
</div>
<div class="body-content" style="margin-top: 40px;">
<div class="container-fluid">
<div class="row-fluid">
@RenderBody()
<div class="centering col-lg-6 footer" style="text-align: center; margin-bottom: 25px;">
<ul>
<li><a href="#">About us</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Help</a></li>
<li><a href="#">Privacy</a></li>
<li><a href="#">Cookies</a></li>
</ul>
<div style="float: right; margin-bottom: 25px; margin-right: -15px;">
<img src="https://sdltridionworld.com/images/AppStore-Icon_tcm89-19881.png" width="100" height="35" />
<img src="https://portal.xsede.org/dashboard-portlet/images/playstore.png" width="90" height="35" />
</div>
</div>
</div>
</div>
</div>
</body>
</html>
我遇到的问题是当我点击链接时,我被重定向到新页面localhost:65148 / ProfileLogin / Edit。我希望部分视图显示在divbox result
中。我做错了什么?