Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Professional ASP.NET MVC 4
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET MVC 4
This is the forum to discuss the Wrox book Professional ASP.NET MVC 4 by Jon Galloway, Phil Haack, Brad Wilson, K. Scott Allen; ISBN: 978-1-118-34846-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET MVC 4 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 20th, 2013, 05:58 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Post Chapter 8 Ajax.ActionLink,page 197. Problem: PartialView displayed as its own page.

In Chapter 8 Ajax ActionLink, at page 197, I struggled for hours to get the Ajax.ActionLink to show my partial view inside the Index page.

Problem:
The PartialView was always displayed as its own page.

Story:
I am using the downloaded complete MVC3 version of the MvcMusicStore to walk through the books exercises.
What I did first (as per instructions in the book) was to add the script src in the bottom of my _Layout page like this.
Code:
    <script src="@Url.Content("~/Scripts/jquery-2.0.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
        @RenderSection("scripts", required: false)
</body>
</html>
For some reason this just wouldn’t work and after a couple of hours with different changes, tests and searching on goggle
I found a page* with the (almost) same instructions and copied the following unobtrusive row to my code, just in case I had a typo in mine.
Code:
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
The only difference was that this is not the minimized version, and using this instead actually (surprisingly) worked.

Solution:
Make sure that you use the full unobtrusive script as below.
Code:
<script src="@Url.Content("~/Scripts/jquery-2.0.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
        @RenderSection("scripts", required: false)
</body>
</html>
Before I got this to work I did set up an identical test using a new MVC4 Project and it worked as it should,
so I thought that it could be a corrupted jQuery script and copied the known working “unobrousive-ajax” files to my MVC3 project, with no luck.
Probably there is a bug in the minimized version and you will need to use the full version.
Please update me on this if this is not true.
I hope this is helpful to someone else.
//Jimi
newsweb.se


* http://stackoverflow.com/questions/7...295909#7295909

Last edited by JimiFriis; June 20th, 2013 at 06:01 AM. Reason: updated title
Reply With Quote
  #2 (permalink)  
Old March 25th, 2015, 05:18 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default more resources

you can visit http://mvc4all.com for more exmaples
Reply With Quote
Reply


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
Chapter 8 Ajax ActionLink page 197 error/problem and solution JimiFriis BOOK: Professional ASP.NET MVC 4 0 June 19th, 2013 11:27 AM
a problem on page 197 Dan Cern BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 March 5th, 2010 05:28 AM
Chapter 6: Page 197 - CSS placement VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 11 April 7th, 2008 02:43 PM
the page cannot be displayed aspweb BOOK: Beginning ASP.NET 1.0 1 October 20th, 2003 08:41 PM
"Page cannot be displayed" delcyan Classic ASP Basics 6 June 22nd, 2003 03:58 PM



All times are GMT -4. The time now is 07:13 PM.


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