我收到了这个错误:
The model item passed into the dictionary is of type 'System.Boolean', but this dictionary requires a model item of type 'DunyaYazilim.Models.TBL_CATEGORIES'.
这是我的看法:
@model DunyaYazilim.Models.TBL_CATEGORIES
@{
ViewBag.Title = "EditCategory";
}
@using (Html.BeginForm((string)ViewBag.FormAction, "Administrator"))
{
<div>
<div>Category Name</div>
<div>@Html.TextBoxFor(m => m.Name)</div>
<input type="submit" value="Submit" />
</div>
}
这是控制器:
public ActionResult EditCategory(int CategoryID)
{
return PartialView(entity.TBL_CATEGORIES.Select(c=>c.CategoryID==CategoryID).FirstOrDefault());
}
和行动链接:
@Html.ActionLink("update", "EditCategory", "Administrator", new { CategoryID = categories.CategoryID }, new { @class = "openDialog", dialog_id = "EditCategory", dialog_title = "Update Category" })
谢谢。