I'm basically developing a kind of social network, however I'm having some problems rendering pages within 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 are giving this error
A public action method 'RequestToAccept' was not found on controller 'ManyLife.ASP.Areas.Professional.Controllers.ProfessionalUserHasClientController'.
If I modify to 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'm doing the best, but the print below shows the situation, I need to access the "RequestToAccept.cshtml" in that open tab on the right side, and with each view change it reloads it, since it keeps waiting for requests of requests for "friendship":
MyController
[Authorize]publicclassProfessionalUserHasClientController:Controller{publicActionResultDashboard(ProfessionalUserpUser){List<SimpleUser>listProfessionalUserHasClient=newList<SimpleUser>();using(ProfessionalUserDAOdao=newProfessionalUserDAO()){listProfessionalUserHasClient=dao.ListProfessionalHasClient(pUser.IdProfessionalUser);}returnView(listProfessionalUserHasClient);}[HttpPost]publicActionResultRequestToAccept(){ProfessionalUserpUser=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 left menu to call other views from other controls, it says I'm trying to load an object of type SimpleUser into a View that expects a List of an object type "x"
, and in the action that it should pass, it returns this list normally to the View.