Wrox Programmer Forums
|
BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
This is the forum to discuss the Wrox book ASP.NET MVC Website Programming Problem Design Solution by Nicholas Berardi, Al Katawazi, and Marco Bellinaso; ISBN: 9780470410950
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 23rd, 2013, 07:24 AM
Registered User
 
Join Date: Oct 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default MVC 4 + @HtmlDropDownFor + 2 tables

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 ?





Similar Threads
Thread Thread Starter Forum Replies Last Post
MVC 2 ApplyOriginalValues Montero ASP.NET 4 General Discussion 0 May 18th, 2013 02:46 PM
Errors while upgrade theBeerHouse mvc project form asp.net mvc 1.0 to 2.0 vanbach1304 BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 0 April 20th, 2010 06:43 AM
MVC tedr BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 4 February 5th, 2010 11:43 AM
TheBeerHouse MVC preview ASP.NET MVC Website Programming Problem Design Solution jminatel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 July 18th, 2009 09:16 AM
mvc datta123 Struts 1 October 26th, 2006 11:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.