I have a menu being loaded into an Action from a controller. I already configured the view of this action in _ViewStart to be the default of my project. But this view is not pulling any information from the comtroller. I have already tried by ViewBag, by Model and now I am trying for Session.
Pages that are configured to be the default Layout, can not receive actions from the controllers?
Follow my controller:
public class MenuController : Controller
{
// GET: Menu
public ActionResult Index()
{
return View();
}
public ActionResult Teste()
{
MenuDAO dao = new MenuDAO();
string usuarioLogado = "diego";
IList<Menu> menu = dao.MontaMenu(usuarioLogado);
//ViewBag.Menu = menu;
Session["teste"] = "Essa frase está vindo do controller";
return View();
}
}
Follow my view:
@{
Layout = null;
}
@model IList<PortalAraguaina.Models.Menu>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Teste</title>
</head>
<body>
<div>
Teste
<p class="essa-eh-a-classe-de-teste">@Session["teste"]</p>
</div>
<div>@RenderBody()</div>