<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Part 5: Creating a Dynamic UI with Knockout.js</title><link>http://www.asp.net</link><pubDate>Tue, 08 Jan 2013 07:29:41 GMT</pubDate><generator>umbraco</generator><description>Comments for Part 5: Creating a Dynamic UI with Knockout.js</description><language>en</language><atom:link href="http://www.asp.net/rss/comments/42623" rel="self" type="application/rss+xml" /><item><title>Comment Posted by jlserrano</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Fri, 27 Jul 2012 07:40:22 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016056</guid><description><![CDATA[ <p>Hello how to resolve the issue with Update and Create with MVC4 RC </p><p></p><p>i Mean always when you made Update o new actions</p><p></p><p>{&quot;$id&quot;:&quot;1&quot;,&quot;ExceptionType&quot;:&quot;System.InvalidOperationException&quot;,&quot;Message&quot;:&quot;No MediaTypeFormatter is available to read an object of type &#39;Produc&#39; from content with media type &#39;&#39;undefined&#39;&#39;.&quot;,&quot;StackTrace&quot;:&quot; at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)\r\n at System.Web.Http.Mod</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/jlserrano.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by amillen</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Sun, 29 Jul 2012 15:38:32 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016065</guid><description><![CDATA[ <p>I&#39;m new to web api and you say in your note to use System.Web.Mvc.UrlHelper.HttpRouteUrl, however I&#39;m struggling to figure out how to use this in your exercise and I cannot find any examples. Could anyone please provide an example or two for this exercise?</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/amillen.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by waelfarag</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Sat, 25 Aug 2012 10:52:15 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016282</guid><description><![CDATA[ <p>There are 2 Errors in the ProductsViewModel.create method:</p><p>1- Regarding the jQuery post:</p><p>                  $.post(baseUri, $(formElement).serialize(), &quot;json&quot;)   &lt;== </p><p>                      .done(function (o) { self.products.push(o); }); </p><p>the method expects a callback function, for success, in the place of &quot;json&quot;. So, the post will not work, the correct is to put null in the 3rd parameter as we are using &quot;.done&quot;</p><p>                  $.post(baseUri, $(formElement).serialize(), null, &quot;json&quot;)   &lt;== </p><p>                      .done(function (o) { self.products.push(o); }); </p><p>2- regarding KnockoutJS</p><p>the create method bound to Knockout ( data-bind=&quot;submit: create&quot;) will be called with the ViewModel as a first parameter and the Event object as the second parameter, Not the form element.</p><p></p><p> so to get the form element we shoud use:</p><p>             self.create(model, event)</p><p>and we get the serialized data by:</p><p>             $(event.target).serialize();</p><p></p><p>the full Create Method will be:</p><p>          self.create = function (model, event) { </p><p>              // If valid, post the serialized form data to the web api </p><p>              $(formElement).validate(); </p><p>              if ($(formElement).valid()) { </p><p>                  $.post(baseUri, $(event.target).serialize(), null, &quot;json&quot;) </p><p>                      .done(function (o) { self.products.push(o); }); </p><p>              } </p><p></p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/waelfarag.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by waelfarag</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Sat, 25 Aug 2012 11:02:39 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016283</guid><description><![CDATA[ <p>Note( Web Form Developers): as the whole page is inside a form we cannot add a nested form. So to use the Post Method in a web forms with a master page:</p><p>1- Manually create a fieldset element and put the input fields in it :</p><p>        &lt;fieldset&gt;</p><p>            &lt;legend&gt;Contact&lt;/legend&gt;</p><p>            &lt;ul style=&quot;list-style-type: none;&quot;&gt;</p><p>                &lt;li&gt;</p><p>                    &lt;span&gt;Name:&lt;/span&gt;&lt;br /&gt;</p><p>                    &lt;input type=&quot;text&quot; name=&quot;Name&quot; /&gt;</p><p>                &lt;/li&gt;</p><p>                &lt;li&gt;</p><p>                    &lt;span&gt;Price:&lt;/span&gt;&lt;br /&gt;</p><p>                    &lt;input type=&quot;text&quot; name=&quot;Price&quot; /&gt;</p><p>                &lt;/li&gt;</p><p>                &lt;li&gt;</p><p>                    &lt;span&gt;Actual Cost:&lt;/span&gt;&lt;br /&gt;</p><p>                    &lt;input type=&quot;text&quot; name=&quot;ActualCost&quot; /&gt;</p><p>                &lt;/li&gt;</p><p>                &lt;li&gt;</p><p>                    &lt;span&gt;Category:&lt;/span&gt;&lt;br /&gt;</p><p>                    &lt;input type=&quot;text&quot; name=&quot;Category&quot; /&gt;</p><p>                &lt;/li&gt;</p><p>            &lt;/ul&gt;</p><p>            <p></p><p>                &lt;input type=&quot;button&quot; value=&quot;Add Product&quot; data-bind=&quot;click: create&quot; /&gt;</p><p>            </p></p><p>        &lt;/fieldset&gt;</p><p>Note: a) the name of the input elements === the Data Model Names</p><p>         b) the create method is bound to the click event of the button</p><p>2- Then in the create Method:</p><p>            self.create = function (model, event) {</p><p>                // Get the parent fieldset</p><p>                var fs = $(event.target).closest(&quot;fieldset&quot;);</p><p>                var ser = $(&quot;*&quot;, fs).serialize();</p><p>                $.post(baseUri, ser, null, &quot;json&quot;)</p><p>                .done(function (o) { self.products.push(o); });</p><p>            } </p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/waelfarag.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by waelfarag</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Sat, 25 Aug 2012 11:22:47 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016284</guid><description><![CDATA[ <p>Another Error: ko.applyBindings is called before the markup is loaded, better to but it in a ready method:</p><p>        $(function () {</p><p>            ko.applyBindings(new ProductsViewModel());</p><p>        });</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/waelfarag.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by kate0824</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Mon, 17 Sep 2012 04:15:49 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016448</guid><description><![CDATA[ <p>Hi,</p><p>I follow the tutorial but come accross a problem unfortunately. Admin view isn&#39;t get refreshed after get data from backend. I modified the code as following and the problem is resolved. I am not sure if this is a problem. Could anyone please confirm it?</p><p>Original:</p><p>ko.applyBindings(new ProductsViewModel());</p><p>After Modified:</p><p>$(document).ready(function () {</p><p>          ko.applyBindings(new ProductsViewModel());</p><p>      });</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/kate0824.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by MikeWasson</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Tue, 25 Sep 2012 16:26:09 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016513</guid><description><![CDATA[ <p>@waelfarag:</p><p></p><p>1. jQuery post: Thanks, yes, the third parameter should be &#39;null&#39; - I&#39;ll fix this. </p><p></p><p>2. &quot;submit&quot; binding: Actually, KO passes the form element to the submit handler. The submit binding behaves differently from the click binding. See <a rel="nofollow" href="http://knockoutjs.com/documentation/submit-binding.html" target="_blank">knockoutjs.com/</a></p><p></p><p>3. The script section in the MVC view is rendered after the HTML body, so you shouldn&#39;t need a ready method.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/MikeWasson.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by MikeWasson</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Tue, 25 Sep 2012 16:28:54 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016514</guid><description><![CDATA[ <p>re #3 - then again, Kate0824 had the same issue. It can&#39;t hurt to put this call in a ready function. </p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/MikeWasson.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by lccarvalho</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Fri, 28 Dec 2012 13:45:19 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017077</guid><description><![CDATA[ <p>Showing my intimacy with javascript:</p><p></p><p>How do I have the New Product fields cleaned after submitting the new product, must be something inside:  </p><p></p><p>    .done(function (o) { self.products.push(o); }); </p><p></p><p>Where do I learn these things?</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/lccarvalho.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by sangnguyen110</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Mon, 07 Jan 2013 08:56:56 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017130</guid><description><![CDATA[ <p>$.getJSON(url [, data ] [, success(data, textStatus, jqXHR) ] ) (<a rel="nofollow" href="http://api.jquery.com/jQuery.getJSON/" target="_blank">api.jquery.com/</a>). It shows that the second parameter is the data which is sent to the server with the request and in this example $.getJSON(baseUri, self.products) so</p><p> _How url can be map with the acction GetProducts() in admincontroller because this action doesn&#39;t take a list of product as parameter. </p><p>_And how the products array in ProductsViewModel object can take the json response from server.</p><p>Thank!</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/sangnguyen110.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by priyankmtr</title><link>http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-5</link><pubDate>Tue, 08 Jan 2013 07:29:41 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017136</guid><description><![CDATA[ <p>every thing worked fine for me. i never had any issue while following things exactly. even i learn knockout.js also with the help of this example. thanks Mike. you rocked !!</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/priyankmtr.jpg?forceidenticon=false&amp;dt=635045431800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>