0
我在嘗試返回我的mvc 5網站上的視圖@Html.ActionLink("Details", "Details", "Users", new { id = UserSearch.Id }, null)
時出現錯誤。未找到'詳情'或其主人的視圖或沒有視圖引擎支持搜索到的位置
我一直在recieving錯誤`
The view 'Details' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Users/Details.aspx
~/Views/Users/Details.ascx
~/Views/Shared/Details.aspx
~/Views/Shared/Details.ascx
~/Views/Users/Details.cshtml
~/Views/Users/Details.vbhtml
~/Views/Shared/Details.cshtml
~/Views/Shared/Details.vbhtml`
但是類似的行動環節的工作完全正常在我的網站。
任何幫助將是偉大的。
用戶控制器
public ActionResult Details(string Id)
{
if (Id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
ApplicationUser user = db.Users.Find(Id);
if (user == null)
{
return HttpNotFound();
}
return View(user);
}
詳細信息頁面
@model BiteWebsite.Models.ApplicationUser
@{
ViewBag.Title = "Details";
}
<h2>Details</h2>
<div>
<h4>Meal</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.FirstName)
</dt>
<dd>
@Html.DisplayFor(model => model.FirstName)
</dd>
<dt>
@Html.DisplayNameFor(model => model.County)
</dt>
<dd>
@Html.DisplayFor(model => model.County)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Gender)
</dt>
<dd>
@Html.DisplayFor(model => model.Gender)
</dd>
<dt>
@Html.DisplayNameFor(model => model.UserName)
</dt>
<dd>
@Html.DisplayFor(model => model.UserName)
</dd>
</dl>
</div>
更新 用戶模型
public class ApplicationUser : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string Gender { get; set; }
public string HouseNumber { get; set; }
public string StreetName { get; set; }
public string County { get; set; }
public string PostCode { get; set; }
public string DateofBirth { get; set; }
public virtual UserCuisineChoice UserCuisineChoice { get; set; }
}
您能展示模型嗎? – aw04
我已添加用戶模型 – Dolaps
什麼文件路徑是您的詳細信息頁面,名稱是什麼? –