4
I’m basically developing a kind of social network, but I’m having some problems rendering pages inside my _Layout.cshtml page.
Html
<ul class="dropdown-menu">
<li class="header">Você tem @pUser.RequestsToAccept.Count requisições enviadas.</li>
@{Html.RenderAction("RequestToAccept", "ProfessionalUserHasClient");}
<li class="footer"><a href="#">Últimas requisições enviadas</a></li>
</ul>
You’re making this mistake
A public action method 'Requesttoaccept' was not found on controller 'Manylife.ASP.Areas.Professional.Controllers.Professionaluserhasclientcontroller'.
If I modify for Renderpage
<li class="header">
Você tem @pUser.RequestsToAccept.Count requisições enviadas.
</li>
@RenderPage("~/Areas/Professional/Views/ProfessionalUserHasClient/RequestToAccept.cshtml")
<li class="footer"><a href="#">Últimas requisições enviadas</a></li>
{"Erro ao executar a solicitação filho do manipulador 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'."}
I do not know if I am doing the best way, but the print below shows the situation, I need to access the "Requesttoaccept.cshtml" in that open tab on the right side, and every view exchange reloads it, because it is waiting for requests for "friendship requests":
Man Controller
[Authorize]
public class ProfessionalUserHasClientController : Controller
{
public ActionResult Dashboard(ProfessionalUser pUser)
{
List<SimpleUser> listProfessionalUserHasClient = new List<SimpleUser>();
using (ProfessionalUserDAO dao = new ProfessionalUserDAO())
{
listProfessionalUserHasClient = dao.ListProfessionalHasClient(pUser.IdProfessionalUser);
}
return View(listProfessionalUserHasClient);
}
[HttpPost]
public ActionResult RequestToAccept()
{
ProfessionalUser pUser = Session["ProfessionalUserLogged"] as ProfessionalUser;
return View(pUser.RequestsToAccept);
}
[HttpPost]
public ActionResult RequestSended()
{
ProfessionalUser pUser = Session["ProfessionalUserLogged"] as ProfessionalUser;
return View(pUser.RequestSended);
}
}
NOTE: I forgot to tell you that using @RenderPage
it loads normally, but when I use the menu on the left to call other views from other controls, it says that I’m trying to load a Simpleuser type object into a View that expects a List from a type object "x"
, in the action that he should pass, he returns this list normally to the View.
I believe your problem is that your controller methods are POST. Remove Annotation [Httppost] from Requesttoaccept and try again.
– Vinícius
@Vinícius {Cannot evaluate Expression because the Current thread is in a stack overflow state.}
– Luiz Negrini