Here is my controller code :
public ActionResult Index()
{
AccountModel user = new AccountModel();
user.Username = "Jay";
user.Password = "Jay";
ViewData["EmpData"] = user;
return View();
}
How can I cast the ViewData["EmpData"] in the view code ?
return View(user);and add@model userin the view@modelstatement in the view. You could use@{ var user = ViewData["EmpData"] as user; }but what would be the point