<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Editable Grid / List Binding in MVC2</title>
	<atom:link href="http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/</link>
	<description>The Technology Blog of Donn Felker</description>
	<lastBuildDate>Tue, 07 Sep 2010 01:08:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: alindzon</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-187</link>
		<dc:creator>alindzon</dc:creator>
		<pubDate>Wed, 14 Jul 2010 06:47:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-187</guid>
		<description>I am killing myself to just change the index which is view only that MVC2 creates to be an editable grid instead.  Its much more elegant for a normal file.&lt;br&gt;&lt;br&gt;I have already written the code to break up the table into pages including first, prior, next, and last links as well as searching etc..&lt;br&gt;&lt;br&gt;Now all I need is a simple way to build up a structure like you have.&lt;br&gt;&lt;br&gt;Is there any way you would consider doing a simple controller, view, etc.. that shows a table, and allows the data to be updated and posted back to the database?&lt;br&gt;&lt;br&gt;I tried to use your approach, but I cannot get it to even execute, I am definitely missing something.</description>
		<content:encoded><![CDATA[<p>I am killing myself to just change the index which is view only that MVC2 creates to be an editable grid instead.  Its much more elegant for a normal file.</p>
<p>I have already written the code to break up the table into pages including first, prior, next, and last links as well as searching etc..</p>
<p>Now all I need is a simple way to build up a structure like you have.</p>
<p>Is there any way you would consider doing a simple controller, view, etc.. that shows a table, and allows the data to be updated and posted back to the database?</p>
<p>I tried to use your approach, but I cannot get it to even execute, I am definitely missing something.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Donn Felker</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-152</link>
		<dc:creator>Donn Felker</dc:creator>
		<pubDate>Tue, 29 Jun 2010 16:09:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-152</guid>
		<description>You could do any number of things with this example (and I&#039;m glad you posted&lt;br&gt;what you did, thank you), but the code I posted was to illustrate how to&lt;br&gt;perform general list binding in MVC2 without complicating the example with&lt;br&gt;advanced usages. :)&lt;br&gt;&lt;br&gt;Again, thank you for your additions though, I&#039;m sure someone will glean&lt;br&gt;valuable information from this.</description>
		<content:encoded><![CDATA[<p>You could do any number of things with this example (and I&#39;m glad you posted<br />what you did, thank you), but the code I posted was to illustrate how to<br />perform general list binding in MVC2 without complicating the example with<br />advanced usages. <img src='http://blog.donnfelker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Again, thank you for your additions though, I&#39;m sure someone will glean<br />valuable information from this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Likeuclinux</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-149</link>
		<dc:creator>Likeuclinux</dc:creator>
		<pubDate>Mon, 28 Jun 2010 22:52:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-149</guid>
		<description>maybe it is better to let user see the change he made instead of setting a break point, &lt;br&gt;I created a static method inside Customer class:&lt;br&gt;&lt;br&gt; public static Customer Create() { &lt;br&gt;            var customer = new Customer&lt;br&gt;            {&lt;br&gt;                FirstName = &quot;Bob&quot;,&lt;br&gt;                LastName = &quot;Jackson&quot;&lt;br&gt;            };&lt;br&gt;            customer.Orders = new List&lt;Order&gt;&lt;br&gt;                                  {&lt;br&gt;                                      new Order&lt;br&gt;                                          {&lt;br&gt;                                              OrderNumber =  &quot;OR-001&quot;,&lt;br&gt;                                              LineItems = new List&lt;LineItem&gt;&lt;br&gt;                                                              {&lt;br&gt;                                                                  new LineItem { Name = &quot;Chocolate&quot;, Price = 1.99, Quantity = 2},&lt;br&gt;                                                                  new LineItem { Name = &quot;Coffee&quot;, Price = 4.99, Quantity = 1},&lt;br&gt;                                                                  new LineItem { Name = &quot;Chrome Rims&quot;, Price = 199.99, Quantity = 4}&lt;br&gt;                                                              }&lt;br&gt;                                          }, &lt;br&gt;                                          new Order&lt;br&gt;                                          {&lt;br&gt;                                              OrderNumber =  &quot;OR-002&quot;,&lt;br&gt;                                              LineItems = new List&lt;LineItem&gt;&lt;br&gt;                                                              {&lt;br&gt;                                                                  new LineItem { Name = &quot;Sneakers&quot;, Price = 51.99, Quantity = 1},&lt;br&gt;                                                                  new LineItem { Name = &quot;Iced Out Grill Piece&quot;, Price = 4099.99, Quantity = 1},&lt;br&gt;                                                                  new LineItem { Name = &quot;iPad&quot;, Price = 4.99, Quantity = 4}&lt;br&gt;                                                              }&lt;br&gt;                                          }, &lt;br&gt;&lt;br&gt;                                  };&lt;br&gt;&lt;br&gt;            return customer;&lt;br&gt;        }&lt;br&gt;&lt;br&gt;Then in controller simply do this:&lt;br&gt;&lt;br&gt;       static Customer fCustomer = Customer.Create();&lt;br&gt;        public ActionResult Index()&lt;br&gt;        {&lt;br&gt;            return View(fCustomer);&lt;br&gt;        }&lt;br&gt;      &lt;br&gt;       public ActionResult Save(Customer customer)&lt;br&gt;        {   &lt;br&gt;            fCustomer = customer;  //add this line for user change&lt;br&gt;&lt;br&gt;            // Set a breakpoint here and then investigate the customer, their orders and line items&lt;br&gt;            // to see that they have changed.            &lt;br&gt;            Console.WriteLine(customer.Orders.Count());&lt;br&gt;            Console.WriteLine(customer.Orders.First().LineItems.First().Name);&lt;br&gt;            return RedirectToAction(&quot;index&quot;);&lt;br&gt;        }</description>
		<content:encoded><![CDATA[<p>maybe it is better to let user see the change he made instead of setting a break point, <br />I created a static method inside Customer class:</p>
<p> public static Customer Create() { <br />            var customer = new Customer<br />            {<br />                FirstName = &#8220;Bob&#8221;,<br />                LastName = &#8220;Jackson&#8221;<br />            };<br />            customer.Orders = new List&lt;Order&gt;<br />                                  {<br />                                      new Order<br />                                          {<br />                                              OrderNumber =  &#8220;OR-001&#8243;,<br />                                              LineItems = new List&lt;LineItem&gt;<br />                                                              {<br />                                                                  new LineItem { Name = &#8220;Chocolate&#8221;, Price = 1.99, Quantity = 2},<br />                                                                  new LineItem { Name = &#8220;Coffee&#8221;, Price = 4.99, Quantity = 1},<br />                                                                  new LineItem { Name = &#8220;Chrome Rims&#8221;, Price = 199.99, Quantity = 4}<br />                                                              }<br />                                          }, <br />                                          new Order<br />                                          {<br />                                              OrderNumber =  &#8220;OR-002&#8243;,<br />                                              LineItems = new List&lt;LineItem&gt;<br />                                                              {<br />                                                                  new LineItem { Name = &#8220;Sneakers&#8221;, Price = 51.99, Quantity = 1},<br />                                                                  new LineItem { Name = &#8220;Iced Out Grill Piece&#8221;, Price = 4099.99, Quantity = 1},<br />                                                                  new LineItem { Name = &#8220;iPad&#8221;, Price = 4.99, Quantity = 4}<br />                                                              }<br />                                          }, </p>
<p>                                  };</p>
<p>            return customer;<br />        }</p>
<p>Then in controller simply do this:</p>
<p>       static Customer fCustomer = Customer.Create();<br />        public ActionResult Index()<br />        {<br />            return View(fCustomer);<br />        }</p>
<p>       public ActionResult Save(Customer customer)<br />        {   <br />            fCustomer = customer;  //add this line for user change</p>
<p>            // Set a breakpoint here and then investigate the customer, their orders and line items<br />            // to see that they have changed.            <br />            Console.WriteLine(customer.Orders.Count());<br />            Console.WriteLine(customer.Orders.First().LineItems.First().Name);<br />            return RedirectToAction(&#8220;index&#8221;);<br />        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Donn Felker</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-148</link>
		<dc:creator>Donn Felker</dc:creator>
		<pubDate>Mon, 28 Jun 2010 21:17:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-148</guid>
		<description>Very true. I did not include that in the sampel because I did not need to&lt;br&gt;edit it. But if you need it for binding/look ups then you will need to&lt;br&gt;either put it in a hidden or text field. Thanks for the note!</description>
		<content:encoded><![CDATA[<p>Very true. I did not include that in the sampel because I did not need to<br />edit it. But if you need it for binding/look ups then you will need to<br />either put it in a hidden or text field. Thanks for the note!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Likeuclinux</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-147</link>
		<dc:creator>Likeuclinux</dc:creator>
		<pubDate>Mon, 28 Jun 2010 21:11:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-147</guid>
		<description>Order: &lt;%= Model.OrderNumber%&gt; will cause postback OrderNumber to be NULL, change to:&lt;br&gt;&lt;br&gt;&lt;h3&gt;Order:&lt;%= Html.TextBoxFor(x=&gt;x.OrderNumber) %&gt; &lt;br /&gt;&lt;/h3&gt;</description>
		<content:encoded><![CDATA[<p>Order: &lt;%= Model.OrderNumber%&gt; will cause postback OrderNumber to be NULL, change to:</p>
<h3>Order:&lt;%= Html.TextBoxFor(x=&gt;x.OrderNumber) %&gt; <br /></h3>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gini Wong</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-135</link>
		<dc:creator>Gini Wong</dc:creator>
		<pubDate>Mon, 21 Jun 2010 22:43:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-135</guid>
		<description>I tried this model and when I added ValdiationMessageFor(m=&gt;m[i].Name)&lt;br&gt;I got exception :The given key was not present in the dictionary.</description>
		<content:encoded><![CDATA[<p>I tried this model and when I added ValdiationMessageFor(m=&gt;m[i].Name)<br />I got exception :The given key was not present in the dictionary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Donn Felker</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-74</link>
		<dc:creator>Donn Felker</dc:creator>
		<pubDate>Fri, 23 Apr 2010 07:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-74</guid>
		<description>Steve Sanderson has an example of this actually, you can find it here:&lt;br&gt;&lt;a href=&quot;http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/&quot; rel=&quot;nofollow&quot;&gt;http://blog.stevensanderson.com/2010/01/28/edit...&lt;/a&gt;&lt;br&gt;Good luck!</description>
		<content:encoded><![CDATA[<p>Steve Sanderson has an example of this actually, you can find it here:<br /><a href="http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/" rel="nofollow"></a><a href="http://blog.stevensanderson.com/2010/01/28/edit.." rel="nofollow">http://blog.stevensanderson.com/2010/01/28/edit..</a>.<br />Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexandre Jobin</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-66</link>
		<dc:creator>Alexandre Jobin</dc:creator>
		<pubDate>Wed, 14 Apr 2010 23:21:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-66</guid>
		<description>hi Donn!&lt;br&gt;&lt;br&gt;the example is great but it miss the way we can add a new row to the collection. How can you do that and have a the right sequence Id for the new fields?&lt;br&gt;&lt;br&gt;i try to make it via jQuery and ajax!&lt;br&gt;thank you very much if you have a solution for that.</description>
		<content:encoded><![CDATA[<p>hi Donn!</p>
<p>the example is great but it miss the way we can add a new row to the collection. How can you do that and have a the right sequence Id for the new fields?</p>
<p>i try to make it via jQuery and ajax!<br />thank you very much if you have a solution for that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Donn Felker</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-59</link>
		<dc:creator>Donn Felker</dc:creator>
		<pubDate>Mon, 05 Apr 2010 08:20:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-59</guid>
		<description>You can do this (do it at my current client actually). However, you&#039;ll need to re-hydrate your select list&#039;s (drop down list items) via a custom model binder. When the model is posted, intercept it with the model binder, populate the list(s) and mark the selected item and then continue on. :)</description>
		<content:encoded><![CDATA[<p>You can do this (do it at my current client actually). However, you&#39;ll need to re-hydrate your select list&#39;s (drop down list items) via a custom model binder. When the model is posted, intercept it with the model binder, populate the list(s) and mark the selected item and then continue on. <img src='http://blog.donnfelker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Travis</title>
		<link>http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/comment-page-1/#comment-54</link>
		<dc:creator>Travis</dc:creator>
		<pubDate>Wed, 31 Mar 2010 03:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/#comment-54</guid>
		<description>I&#039;d like to see this with a DropDownList.</description>
		<content:encoded><![CDATA[<p>I&#39;d like to see this with a DropDownList.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
