Wrox Programmer Forums
BOOK: Professional ASP.NET MVC 3
This is the forum to discuss the Wrox book Professional ASP.NET MVC 3 by Jon Galloway, Phil Haack, Brad Wilson, K. Scott Allen; ISBN: 978-1-1180-7658-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET MVC 3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 23rd, 2011, 01:09 PM
Registered User
Join Date: Aug 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default View Refresh?

I am having an issue with MVC3 Views not refreshing which is the main reason I purchased the book though I am happy to have it.

Summary of problem:
1. I have a view with a table that gets loaded with a collection of Model items for a WCF Service. Also has a create item link
2. I click the create item link which takes me to a create item view (form). I complete the form and submit, the database gets updated and by debugging I can verify that the class variable in the HomeController (list of items) includes the new item created.
3. Submitting the form take me to an Item Details View, displaying the properties of the item I just created. The Details View has a Back to List action link.
4. Click the Back to List action link, takes me back to the Item table in step 1 above but no changes are displayed in the table. I can verify that the SQL database has been unpdated as well as the Class variable in HomeController. Interestingly enough, I put a break point in the action controller and when I click on the “Back to List” actionlink from the Details View, the code in the HomeController is not even invoked! Its like it isn’t even trying to do anything.

So I thought that maybe the view was being cached, I tried everything I could find online about disabling caching to no avail
I can’t help feeling like I am missing something basic. Any help would be greatly appreciated.
Old August 24th, 2011, 04:48 PM
Registered User
Join Date: Aug 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default UPDATE

Since this is a mobile website, I have included the following script and css in the head section of my _LayoutMobile.cshtml


These includes format the website into an almost "App" like feel. However, if I remove these two form my _LayoutMobile.cshtml, my views update no problem. However, these removes all the formating and special scripts that really make the site.

Has anyone else run into a problem similar to this? I am going to dive into the jQuery and see if I can figure out whats going on, if I do, I will post the answer

Old August 31st, 2011, 05:20 PM
Wrox Author
Join Date: Oct 2006
Posts: 36
Thanks: 1
Thanked 5 Times in 5 Posts
Default jQuery Mobile Caching

Leon -

It looks like the issue you're dealing with isn't specific to ASP.NET MVC, it's with jQuery Mobile. jQuery Mobile has some built-in caching, and the simplest solution is to disable the caching where it's not needed.

Here are a few links with some options on how to do that:
The Following User Says Thank You to JonGalloway For This Useful Post:
lcbenson (August 31st, 2011)
Old August 31st, 2011, 05:25 PM
Registered User
Join Date: Aug 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default That was it!

Thanks for the reply,

that was the problem, I added the following code in my _LayoutMobile.cshtml

<script type="text/javascript">
        $(document).bind("mobileinit", function () {
            $.mobile.ajaxLinksEnabled = false;
NOTE: This code needed to be added BEFORE I called my Mobile jQuery script.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent - Send mail with plain view and html view ashish.dadhwal ASP.NET 2.0 Professional 0 November 27th, 2008 01:49 AM
Refresh GridView Using Refresh Button msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 05:57 AM
Refresh datasheet-view subform’s column headings f pkaptein1 Access 2 June 1st, 2005 04:27 PM
Refresh Button and View State Sunil Sabir General .NET 3 August 16th, 2004 02:40 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.