Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 23rd, 2011, 02:09 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Leon
  #2 (permalink)  
Old August 24th, 2011, 05:48 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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

http://code.jquery.com/mobile/1.0a3/...e-1.0a3.min.js
http://code.jquery.com/mobile/1.0a3/...-1.0a3.min.css

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

Leon
  #3 (permalink)  
Old August 31st, 2011, 06:20 PM
Wrox Author
Points: 165, Level: 3
Points: 165, Level: 3 Points: 165, Level: 3 Points: 165, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: San Diego, CA, USA
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)
  #4 (permalink)  
Old August 31st, 2011, 06:25 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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

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

Leon
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 05:27 PM
Refresh Button and View State Sunil Sabir General .NET 3 August 16th, 2004 03:40 PM



All times are GMT -4. The time now is 03:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.