I'm using MVC 4, EF 4.3 and the MVCScaffolding package.
I have following simple model classes
public class Product
{
[Key]
public int ID { get; set; }
[Required]
public string Name { get; set; }
public virtual Category Category { get; set; }
}
public class Category
{
[Key]
public int ID { get; set; }
public string Name { get; set; }
public virtual ICollection<Product> Products { get; set; }
}
I scaffolded out the controllers like so:
Scaffold Controller Category -Force
Scaffold Controller Product -Force
This generated the controllers/views etc.
Per Steve sanderson's post I would think that the _CreateOrEdit.cshtml for the Product would contain a dropdown for the Category but it does not.
Followng are the contents of the _CreateOrEdit.cshtml and it does not contain any html template for the Category
<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>
What am I doing wrong?