mvc scaffolding with navigation property

SuilsSpubRutt

New Member
I am new to Asp.net MVC (currently using newest version).I created my database using EF Codefirst technique and then created my controller and views for my model using scaffolding. The code is below: \[code\]public class Item{ [Key] public int ID { get; set; } public string ItemCode { get; set; } public string ItemDescription { get; set; } public bool isAsset { get; set; } public virtual Unit unit { get; set; }} public class Unit { [Key] public string unit { get; set; } }\[/code\]The unit is just text which is read from a sql table of units. If I create a string unit field in item class then EF won't create a seperate table for unit.The problem is that I want to have simple listbox selection in my view for Unit field. But asp.net mvc scaffolding doesn't create the any field for unit navigation property in my view. Should I create my listbox field manually or am I doing something wrong? Another problem with this approach seems to be that my items view will not have reference to unit model.
 
Back
Top