1
I have the problem that when I click on the Register button, the City does not pass the ID. I did. The ID is being passed to the screen, but when passing to the controller is not.
<div class="alinhado col-md-4">
<div class="form-group">
<div class=" alinhadoLabel">
@Html.Label("Cidade", htmlAttributes: new { @class = "control-label" })
</div>
<div class="alinhadoEditor">
<select class="form-control" id="City"><option value="0">Selecione</option></select>
</div>
</div>
</div>
This is the controller:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "PeopleID,Name,Email,Password,Address,Number,Neighborhood,ZipCode,Photo,Type,Active,Validate,DateBirth,Register,CityID")] People people)
{
if (ModelState.IsValid)
{
db.Peoples.Add(people);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(people);
}
and here the error:
The Name property was really missing, but Cityid didn’t work, it had to be City only
– Fabio Souza