0
I’m using a ready template and I use the bootstrap, but the menu transaction is done through javascript animations and with the tag <Section>
html, as follows:
<section class="section" id="registerProfessionalUser">
<div class="container">
@Html.RenderAction("Create", "ProfessionalUser")
</div>
</section>
But when I click the button it does not render the page I want with this @Html.RenderAction("Create", "ProfessionalUser)
and that’s just what I need to do, if I use the RenderPage
it even renders the HTML, but does not pass through Action Create
which is what I need (and I also think is not a good practice), because in this action it returns to the View two lists that I need to use.
Action Create:
public ActionResult Create()
{
ProfessionalSpecializationDAO pSpecializationDAO = new ProfessionalSpecializationDAO();
ViewBag.ListProfessionalSpecialization = pSpecializationDAO.ListProfessionalSpecialization(0);
ProfessionalTypeDAO pTypeDAO = new ProfessionalTypeDAO();
ViewBag.ListProfessionalType = pTypeDAO.ListProfessionalType(0);
return View();
}
View Create:
@using ManyLife.ASP.Areas.Professional.Models
@model ManyLife.ASP.Models.ProfessionalUser
<style>
.editor-field input {
width: 100%;
}
</style>
<div class="container row" style="margin-left: auto; margin-right: auto">
<h2 class="text-center title">Novo Profissional</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend></legend>
<div class="col-sm-4">
<div class="editor-label">
@Html.LabelFor(model => model.IdProfessionalUser)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.IdProfessionalUser)
@Html.ValidationMessageFor(model => model.IdProfessionalUser)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Email)
@Html.ValidationMessageFor(model => model.Email)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.ReEmail)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.ReEmail)
@Html.ValidationMessageFor(model => model.ReEmail)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Password)
@Html.ValidationMessageFor(model => model.Password)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.RePassword)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.RePassword)
@Html.ValidationMessageFor(model => model.RePassword)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.IdProfessionalRegister)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.IdProfessionalRegister)
@Html.ValidationMessageFor(model => model.IdProfessionalRegister)
</div>
</div>
<div class="col-sm-4">
<div class="editor-label">
@Html.LabelFor(model => model.IdProfessionalSpecialization)
</div>
<div class="editor-field" style="overflow-y: auto; height: 200px;">
<label>Especializações:</label>
@{
foreach (var item in ViewBag.ListProfessionalSpecialization)
{
<label>specialty</label>
}
Html.ValidationMessageFor(model => model.IdProfessionalSpecialization);
}
</div>
<div class="editor-field" style="overflow-y: auto; height: 200px;">
<label>Tipos:</label>
@{
foreach (var item in ViewBag.ListProfessionalType)
{
<label>specialty</label>
}
}
</div>
<div class="editor-label">
@Html.LabelFor(model => model.City)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.City)
@Html.ValidationMessageFor(model => model.City)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.State)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.State)
@Html.ValidationMessageFor(model => model.State)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Phone)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Phone)
@Html.ValidationMessageFor(model => model.Phone)
</div>
</div>
</fieldset>
<p>
<input type="submit" value="Create" />
</p>
}
</div>
This is giving the following error in VS: "Error executing 'System.Web.Mvc.Httphandlerutil+Serverexecutehttphandlerasyncwrapper' handler request." In the browser appears: "The public action method 'Professionaluser' was not found on controller 'Manylife.ASP.Controllers.Homecontroller'."
– Luiz Negrini
You changed the method name on
Controller
, as I indicated in the reply? FromCreate
forProfessionalUser
?– Leonel Sanches da Silva
Yes, I changed everything like this one
– Luiz Negrini
"A public action method 'Professionaluser' was not found on controller 'Manylife.ASP.Controllers.Homecontroller'." Innerexception led me here, however, I do not request the Homecontroller at any time. Only if Chilgactiononly calls you somehow, if it is, I don’t know how to fix it either.
– Luiz Negrini
That one
Action
needs to be in theController
who calls theView
, otherwise it won’t even work.– Leonel Sanches da Silva
I leave in the 2 controllers then?
– Luiz Negrini
The ideal is to leave in one, but make it work first. Then you remove one of them.
– Leonel Sanches da Silva