Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 23rd, 2013, 08:24 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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 ?
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MVC 2 ApplyOriginalValues Montero ASP.NET 4 General Discussion 0 May 18th, 2013 03: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 07: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 10:16 AM
mvc datta123 Struts 1 October 26th, 2006 12:00 PM



All times are GMT -4. The time now is 10:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.