I failed to get a full explanation for the above senario. Let me explain it further. I have 2 tables in the Database with a common field.
Table 1 field needs a string value which should be selected with a dropdown in the Create and Edit sections. Obviously this Dropdown should be populated from the data that comes from Table 2.
Using the Reverse Engineering I have formed the Models by directly connecting to the SQL Server 2008. After that the MVC 4 tools (right click+create) it was easy enough to form the Controllers & the Views (Create, Edit, Delete, etc..) for every model. But now I need to modify the mentioned area in the Create & Edit sections from :
Code:
@Html.EditorFor(model => model.ArizaTipi)
to something like
Code:
@Html.DropDownListFor(model => model.TheField, ViewBag.TheField as List<SelectListItem>, "All")
One thing to mention is that the field has the same name on both tables.
How would I achieve this ? Frankly I need a good walkthrough instead of referring me to another link or a partial explanation which would be of no use. Would anybody be kind enough to show me what I should do ?