tag:blogger.com,1999:blog-452082413816220321.post1199439870091669785..comments2023-10-31T15:07:16.155+05:00Comments on Random Thoughts: Master detail form in aspnet mvc-3 - IIAnonymoushttp://www.blogger.com/profile/12242114069456113061noreply@blogger.comBlogger42125tag:blogger.com,1999:blog-452082413816220321.post-70549399523932640642014-04-02T23:04:55.309+05:002014-04-02T23:04:55.309+05:00Hi Adeel, thanks for this nice work. I'm looki...Hi Adeel, thanks for this nice work. I'm looking for same kind of work but instead of controller, view directly calls WCF service via JSON so just thinking on that part and other than that as per current application architecture Model class library not to be called directly on view. Please let me know the way around to get this done via JSON call. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-3889033311948222442013-04-26T00:13:20.478+05:002013-04-26T00:13:20.478+05:00Razor-EF sample is missing, can you repost and ale...Razor-EF sample is missing, can you repost and alert us? Thanks!<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-10037587766847483962013-02-20T16:04:52.655+05:002013-02-20T16:04:52.655+05:00Thanks for the backup of the code!
Good movement ...Thanks for the backup of the code!<br /><br />Good movement hosted it on google drive!Nikitohttps://www.blogger.com/profile/07758913819842268432noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-29239864846523299102012-12-13T19:32:23.196+05:002012-12-13T19:32:23.196+05:00Hi Adeel, I would like to see your Razor-EF sample...Hi Adeel, I would like to see your Razor-EF sample too. Reupload it please.<br />ThanksJPShttps://www.blogger.com/profile/06468166997479783909noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-75493459879549027012012-09-20T20:39:39.761+05:002012-09-20T20:39:39.761+05:00Hi Adeel,
I wish to download your Razor-EF code s...Hi Adeel,<br /><br />I wish to download your Razor-EF code sample but it is no longer available on esnips. Can you please upload it again? Or better yet do a step by step tutorial on it? Thanks!<br /><br />Corix<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-24442866628072436592012-09-17T22:31:25.835+05:002012-09-17T22:31:25.835+05:00Hey Keith,
Sorry for the late reply. I was not abl...Hey Keith,<br />Sorry for the late reply. I was not able to find the code my self :). There is one copy of code I could find. I have hosted it on google drive https://docs.google.com/open?id=0B5fJZ50PYETkenZjQlRKYTZRX0k. I hope you wouldn't have problem downloading now.Anonymoushttps://www.blogger.com/profile/12242114069456113061noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-63959153530359554772012-09-05T00:37:08.974+05:002012-09-05T00:37:08.974+05:00Hi Adeel,
How do I download the code from esnips?...Hi Adeel,<br /><br />How do I download the code from esnips? Have been battling with trying to download it, but not sure how.<br /><br />Great articles,<br />KeithKeithhttp://www.cyclingfoodmanpa.comnoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-77338456022357608432012-08-11T03:03:54.884+05:002012-08-11T03:03:54.884+05:00Hi Adeel
I think I have found a way to solve the p...Hi Adeel<br />I think I have found a way to solve the problem<br />@Html.Telerik().ScriptRegistrar().jQuery(false).DefaultGroup(g => g.Combined(true).Compress(true));<br />using an article from here:<br />http://steveclements.net/blog/Using-Telerik-MVC-with-your-own-custom-jQuery-and-or-other-plug-insAnonymoushttps://www.blogger.com/profile/08284197951653137263noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-6293798932890439932012-08-11T00:14:31.438+05:002012-08-11T00:14:31.438+05:00Hi Adeel
I have incorporated your code into my app...Hi Adeel<br />I have incorporated your code into my app without any problem. It uses jquery 1.5.1 and jquery.tmpl beta.<br />My site uses Teletik MVC extetions also, and I am using its menu currently. Teleik uses jquery 1.7.1. when I enable telerik, you code does not work anymore and says "object does not support tmpl method". when I remove jquery 1.7.1 from telerik scripts folder, then your add methods works again but not telerik menu. when I remove jquery 1.5.1 and reference jquery 1.7.1 in my "Order" page the add moethod stops working again. <br />It seems that it does not work with jquery 1.7.1.<br />would you please help me, I need both your code and Telerik togetherAnonymoushttps://www.blogger.com/profile/08284197951653137263noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-80086380388822876782012-08-10T01:01:00.911+05:002012-08-10T01:01:00.911+05:00Yes, when I remove teleik js files especially jque...Yes, when I remove teleik js files especially jquery.min.1.7.1, everything works.Anonymoushttps://www.blogger.com/profile/08284197951653137263noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-56019277903220773702012-08-09T23:33:09.928+05:002012-08-09T23:33:09.928+05:00Javad, are you sure you have added jquery templati...Javad, are you sure you have added jquery templating engine js file in the page. please visit http://api.jquery.com/jquery.tmpl/ for more informationAnonymoushttps://www.blogger.com/profile/12242114069456113061noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-34719589492596669142012-08-09T01:49:30.414+05:002012-08-09T01:49:30.414+05:00Hi
I am trying to use your code in a ASP.NET MVC 3...Hi<br />I am trying to use your code in a ASP.NET MVC 3 app with Telerik MVC extensions. Telerik uses jquery 1.7.1, and your code uses 1.5.1. and add method does not work. I have upgraded it to 1.7.1 but it seems there is a problem with template as I get "object does not support tmpl method". From the other side Telerik does not work with any other version!<br />Would you please help me to overcome this version mismatch problem!!Anonymoushttps://www.blogger.com/profile/08284197951653137263noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-84073275867515222222012-02-22T11:53:16.210+05:002012-02-22T11:53:16.210+05:00thank you very much for your effortthank you very much for your effortSiripongzhttps://www.blogger.com/profile/00367614687364809834noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-66604731774792444692012-01-16T22:42:12.994+05:002012-01-16T22:42:12.994+05:00I hid f5 but nothing happendI hid f5 but nothing happendAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-72122959981349839522011-09-21T14:37:06.425+05:002011-09-21T14:37:06.425+05:00Kishan sorry for late response you can find a samp...Kishan sorry for late response you can find a sample application that saves and fetches record from/to db at http://www.esnips.com/doc/63cc65e3-0bc9-409d-a6ef-795985e58d32/Master-Detail3. plz download and see if it solves your problemAnonymoushttps://www.blogger.com/profile/12242114069456113061noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-74125363833645404802011-09-03T09:01:06.389+05:002011-09-03T09:01:06.389+05:00Hi... that was good example. But in your case you ...Hi... that was good example. But in your case you already coded the records. How will I do when I want to insert new record?Kishan Hathiwalahttp://www.hathiwala.netnoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-74305809808228201762011-08-23T04:43:24.979+05:002011-08-23T04:43:24.979+05:00Ok, now I got it. Thank you so much Adeel, you'...Ok, now I got it. Thank you so much Adeel, you've been very helpful.Germannoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-27785101261877608792011-08-20T19:50:21.405+05:002011-08-20T19:50:21.405+05:00Hello German, where values come from in order para...Hello German, where values come from in order parameter: the answer is from form collection. The modelbinder gathers values from form collection and put it in order object. similarly when we call updatemodel(orderToUpdate), modelbinder comes into play once again and it gets values from form collection and updates the orderToUpdate objectAnonymoushttps://www.blogger.com/profile/12242114069456113061noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-25602594291843238472011-08-19T04:46:21.889+05:002011-08-19T04:46:21.889+05:00Hi, Adeel. Thanks for answering so quickly. I part...Hi, Adeel. Thanks for answering so quickly. I partially understood what you told me (again, I'm a newbie to MVC). I've been debugging step by step that part of code to really see what is happening and I still don't see where orderToUpdate becomes populated with new values coming from the view. When you call "orderRepository.GetOrder(id)" it populates variable orderToUpdate with original values from the database (right?), and then when you call UpdateModel returns with the new values (those that are stored in parameter order) <br />If I understand you correctly, you're saying that UpdateModel does that for itself automatically? <br /><br />Again, thanks for your attention, I really appreciate it.Germannoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-87470208560305999512011-08-18T19:53:00.060+05:002011-08-18T19:53:00.060+05:00Hello German,
order object that comes as paramete...Hello German, <br />order object that comes as parameter is not used in this method at all. I have used it just to make sure that model binding is working properly. You can omit the parameter and everything will work as it did before.<br />your second question is how changed values are updated in the db. The answer is through UpdateModel which calls the modelbinding explicitly. Since orderToUpdate is also of type Order modelbinder is able to iterate through its properties and update its values from valuprovider. Notice that before calling UpdateModel i have deleted all orderlines objects associated with orderToUpdate. This is because when editing detail part of form (orderLines) user can add new lines, delete old lines and edit existing lines so the easiest solution is to delete old orderLines and then re-insert all values we receive from the form post<br />HTHAnonymoushttps://www.blogger.com/profile/12242114069456113061noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-43624714104317132862011-08-18T03:41:41.770+05:002011-08-18T03:41:41.770+05:00Hi Adeel. Excellent post. I'm kinda new to MVC...Hi Adeel. Excellent post. I'm kinda new to MVC so I'm trying to figure out what some things do. I Have a question: In this part of the code<br /><br />[HttpPost]<br />public ActionResult Edit(int id, Order order) <br />{<br /> if (ModelState.IsValid) <br /> {<br /> var orderToUpdate = orderRepository.GetOrder(id);<br /> orderRepository.DeleteOrderLines(orderToUpdate);<br /> UpdateModel(orderToUpdate);<br /> orderRepository.Save();<br /> return View("DisplayOrder", orderToUpdate);<br /> }<br /> return View(order);<br />} <br /><br />in what part do you use variable "order" that comes as a parameter?? and, of course, since that variable comes with the modifications in the order, how does it get updated in the database? <br /><br />Again, thanks for posting this amazing solution and excuse my bad englishGermannoreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-8590932829567187622011-06-14T20:18:01.163+05:002011-06-14T20:18:01.163+05:00@Alen plz change Product.cshtml file and add a cla...@Alen plz change Product.cshtml file and add a class to dropdown list at the end like<br />new { @class = "products" }<br />and in javascript plz bind change event like <br />$('.products').live('change', function () {<br /> alert(this.value);<br />});<br />@JH i found that we can't use script within script tag so we have to put it outside the template somehow. Maybe assigning a class to your date input and calling datepicker in seperate js file. Moreover, if you want to extend master detail to 3 or 4 levels plz have a look at http://blog.reybango.com/2010/07/12/jquery-javascript-templates-tutorial-nesting-templates/ and change code accordinglyAnonymoushttps://www.blogger.com/profile/12242114069456113061noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-64377999668528080032011-06-14T00:06:24.623+05:002011-06-14T00:06:24.623+05:00@Alen i have experienced few problems with js insi...@Alen i have experienced few problems with js inside jquery templates looking for its solution<br />@JH i have just experienced this problem. i will try to get it sorted real soonAnonymoushttps://www.blogger.com/profile/12242114069456113061noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-27116801262321998362011-06-13T23:51:33.399+05:002011-06-13T23:51:33.399+05:00I really appreciate your sample. I'm very clos...I really appreciate your sample. I'm very close to getting it to work in my situation, but I'm having trouble because it seems that any < script /> inside the template views causes malformed HTML. I'm not 100% sure that's my problem yet, but here are 2 walls I'm hitting that lead me to think that embedded script is the problem: 1) One of my editor templates (DateTime) contains a jQuery datepicker script block, and any content after the 1st control that uses that is rendered after the template, and then any script remaining is rendered simply as text in the page HTML; removing the datepicker script block allows the HTML to render properly. 2) I'm attempting to create a master-detail-subdetail page (with 3 levels instead of the 2 in your example), and the same thing happens with any script inside the embedded template-within-a-template. I hope that makes sense. If you have any ideas as to how it would work to have script inside the jQuery template and/or multiple template levels, I would greatly appreciate any hints!Jeffhttps://www.blogger.com/profile/15204868661194590448noreply@blogger.comtag:blogger.com,1999:blog-452082413816220321.post-11464686755720781612011-06-13T19:11:39.870+05:002011-06-13T19:11:39.870+05:00Thank you Adeel, I somehow passed that obstacle, b...Thank you Adeel, I somehow passed that obstacle, but I have a new one :-)<br />I was trying to put some javascript in OrderDetail partial view but without success. The idea is: based on product selected in dropdown show price in the textbox<br />something like<br /><br /> <br /> $("#Product").change(function () {<br /> $("#Product option:selected").each(function () {<br /> $.getJSON("/Dokument/ProductInfo/" + $(this)[0].value, function (data) {<br /> $("#Price")[0].value = data.Price;<br /> });<br /> });<br /> });<br /> <br /><br />it seems that I am unable to reference dropdown or text box from OrderLine partial view.<br />Any ideas?Alennoreply@blogger.com