我有LogoutModel
一个属性。我希望我HomeController
更改此值,View
然后显示此值,但它似乎不起作用。当显示注销视图时,它显示:'再见 Html.LabelFor(m => m.PreviousLoggedInUsername)'
注销型号:
public class LogoutModel
{
public string PreviouslyLoggedInUsername { get; set; }
}
家庭控制器:
public ActionResult Logout(HomeModels.LogoutModel model)
{
model.PreviouslyLoggedInUsername = previousLoggedIn;
return View(model);
}
看法:
@using Ecommerce.Models
@model HomeModels.LogoutModel
@{
ViewBag.Title = "Logout";
Layout = "~/Views/Shared/Master.cshtml";
}
<h2>You have been logged out.</h2>
@using (Html.BeginForm())
{
<table>
<tr>
<td>
<label>Goodbye </label>
Html.LabelFor(m => m.PreviouslyLoggedInUsername)
</td>
</tr>
</table>
}