<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET MVC</title><link>http://forums.asp.net/1146.aspx</link><description>Discussions regarding Model-View-Controller (MVC) support in ASP.NET.  &lt;a href="http://forums.asp.net/1215.aspx"&gt;T4MVC subforum&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: MVC - Model binding with multiple entities on the same page</title><link>http://forums.asp.net/thread/3274668.aspx</link><pubDate>Sat, 04 Jul 2009 13:02:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274668</guid><dc:creator>paul.vencill</dc:creator><author>paul.vencill</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274668.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=3274668</wfw:commentRss><description>&lt;p&gt;You can do this w/ ModelBinding, yes.&amp;nbsp; See&amp;nbsp; my answer to your other post about using a viewmodel to wrap two models.&amp;nbsp; You can do collection-based binding by accepting a List&amp;lt;yourviewmodeltype&amp;gt; parameter in the controller&amp;#39;s POST action, and following the right syntax in the view.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s a&amp;nbsp; good exampel of that.&amp;nbsp; &lt;a href="http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx"&gt;http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can also use helpers, in the manner that I showed in the other post; you just pass the index as a string like Phil shows.&lt;/p&gt;</description></item><item><title>Re: MVC - Model binding with multiple entities on the same page</title><link>http://forums.asp.net/thread/3274406.aspx</link><pubDate>Sat, 04 Jul 2009 07:34:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274406</guid><dc:creator>gerrylowry</dc:creator><author>gerrylowry</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274406.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=3274406</wfw:commentRss><description>&lt;p&gt;I am not an expert, however, I would say yes, you can.&amp;nbsp; See &lt;a href="http://msdn.microsoft.com/en-us/library/dd410405.aspx"&gt;http://msdn.microsoft.com/en-us/library/dd410405.aspx&lt;/a&gt;:&lt;br /&gt;&amp;quot;Models and Model Binders in MVC Applications&amp;quot;:&lt;/p&gt;
&lt;p&gt;&amp;quot;Models are application specific, and therefore the ASP.NET MVC framework puts no restrictions on the kinds of model objects you can build.&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;quot;A model binder in MVC provides a simple way to map posted form values to a .NET Framework&amp;nbsp;type and pass the type to an action method as a parameter. Binders also&amp;nbsp;give you control over the deserialization of types that are passed to action methods. Model binders are like type converters, because they can convert HTTP requests into objects that are passed to an action method. However, they also&amp;nbsp;have information about the current controller context.&amp;quot;&lt;/p&gt;
&lt;p&gt;Read the full article at the above link.&lt;/p&gt;
&lt;p&gt;See also &lt;a href="http://nerddinnerbook.s3.amazonaws.com/Part2.htm"&gt;http://nerddinnerbook.s3.amazonaws.com/Part2.htm&lt;/a&gt;&amp;nbsp;where a one to many* foreign key relationship is set up and &lt;a href="http://nerddinnerbook.s3.amazonaws.com/Part3.htm"&gt;http://nerddinnerbook.s3.amazonaws.com/Part3.htm&lt;/a&gt;&amp;nbsp;where the developers of NerdDinner &amp;quot;use LINQ to SQL to create a simple model that corresponds fairly closely to our database design&amp;quot;.&lt;/p&gt;
&lt;p&gt;* in your case, it seems like you are using a one to one relationship.&amp;nbsp; I tend to think of one to one as a special case of one to many.&amp;nbsp; Keep in mind that I am not a database expert.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Gerry (Lowry)&lt;/p&gt;</description></item><item><title>Re: MVC - Model binding with multiple entities on the same page</title><link>http://forums.asp.net/thread/3274359.aspx</link><pubDate>Sat, 04 Jul 2009 06:59:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274359</guid><dc:creator>LeMerovingian</dc:creator><author>LeMerovingian</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274359.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=3274359</wfw:commentRss><description>&lt;p&gt;Thanks for your reply. I am wondering how to do this if I want to display data from a collection (of which the collection comprises of data from two different entities).&lt;/p&gt;&lt;p&gt;Can I do this with Model Binding?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: MVC - Model binding with multiple entities on the same page</title><link>http://forums.asp.net/thread/3274135.aspx</link><pubDate>Sat, 04 Jul 2009 01:19:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274135</guid><dc:creator>gerrylowry</dc:creator><author>gerrylowry</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274135.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=3274135</wfw:commentRss><description>&lt;p&gt;My guess, something like this:&lt;/p&gt;
&lt;p&gt;private Your&lt;strong&gt;First&lt;/strong&gt;TableDBEntities _db&lt;strong&gt;First&lt;/strong&gt; = new Your&lt;strong&gt;First&lt;/strong&gt;TableDBEntities();&lt;br /&gt;private Your&lt;strong&gt;Second&lt;/strong&gt;TableDBEntities _db&lt;strong&gt;Second&lt;/strong&gt; = new Your&lt;strong&gt;Second&lt;/strong&gt;TableDBEntities();&lt;/p&gt;
&lt;p&gt;on your .aspx page:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Html.Encode(item&lt;strong&gt;First&lt;/strong&gt;.somefield) &amp;amp;nbsp; Html.Encode(item&lt;strong&gt;Second&lt;/strong&gt;.someotherefield)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; et cetera&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards.&lt;br /&gt;Gerry (Lowry)&lt;/p&gt;</description></item><item><title>MVC - Model binding with multiple entities on the same page</title><link>http://forums.asp.net/thread/3273658.aspx</link><pubDate>Fri, 03 Jul 2009 14:17:03 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273658</guid><dc:creator>LeMerovingian</dc:creator><author>LeMerovingian</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273658.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=3273658</wfw:commentRss><description>&lt;p&gt;I am wondering how to use Model Binding in a scenario where I am returning information from more than one entity on a page?&lt;br /&gt;&lt;br /&gt;I want to display a combination of fields from two separate entities, ie Customer + Address. I am using Microsoft&amp;#39;s DAAB and custom business entities for my model.&lt;br /&gt;&lt;br /&gt;Any ideas?&lt;/p&gt;</description></item></channel></rss>