Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB 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 September 24th, 2013, 11:25 AM
Registered User
 
Join Date: Sep 2013
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 11 - jQuery

Maybe it is just me, but I having issues with the Try it Out: Your First jQuery Page. I get an error when loading the page:
Line: 834
Error: Object doesn't support this property or method

I changed the jquery to the normal vs. the min to help with the troubleshooting. Line 833 and 834 are as follows:

[code]
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
[\code]

I am using jquery-2.0.3.js

This is my code from the jquery.aspx

[code]
<%@ Page Title="jQuery Demo" Language="C#" MasterPageFile="~/MaterPages/Frontend.master" AutoEventWireup="true" CodeFile="jQuery.aspx.cs" Inherits="Demos_jQuery" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="Server">
<input id="Button1" type="button" value="button" />
<script type="text/javascript">
$(document).ready(function () {
$('#MainContent').css('background-color', 'green')
$('#Button1').click(function () {
$('#MainContent').css('background-color', 'red')
.animate({ width: '100px', height: '800px' })
});
});
</script>
</asp:Content>
[\code]
(note the spelling of "MaterPages" in case you are copying the code)

Here is my masterpage....
[code]
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPages_Frontend" %>



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<script src="/Scripts/modernizr-2.6.2.js"></script>

</head>

<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-2.0.3.js" />
</Scripts>
</asp:ScriptManager>
<div id="PageWrapper">
<header><a href="/"></a></header>
<nav>
<asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False"></asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" ShowExpandCollapse="False">
<LevelStyles>
<asp:TreeNodeStyle CssClass="FirstLevelMenuItems" />
</LevelStyles>
</asp:TreeView>
</nav>
<section id="MainContent">
<asp:ContentPlaceHolder ID="cpMainContent" runat="server">
</asp:ContentPlaceHolder>
</section>
<aside id="Sidebar">
Select a theme<br />
<asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ThemeList_SelectedIndexCha nged">
<asp:ListItem>Monochrome</asp:ListItem>
<asp:ListItem>DarkGrey</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Horizontal" />
</aside>
<footer>Footer Goes Here</footer>
</div>
</form>
</body>
</html>
[\code]

Any thoughts?

Thank you in advance.
 
Old September 24th, 2013, 11:34 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

When I copy and paste your code, it works fine for me. You're missing a few semi-colons but that shouldn't be a problem.

Two questions:

1. Which browser are you using and which version number does it have?

2. Are you sure you updated the correct master page? You point out the materpage spelling mistake, yet the code behind class of the posted master page seems fine.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old September 24th, 2013, 12:30 PM
Registered User
 
Join Date: Sep 2013
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

First, thank you for the quick reply.

1. I am using IE8. Version 8.0.7601.17514.
2. I only have the one master page with the mispelled folder name.

I noticed my previous projects do not work either and have the same error.
 
Old September 24th, 2013, 12:39 PM
Registered User
 
Join Date: Sep 2013
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Update:

After a bit of searching I found on the jquery page that jquery 2.x is NOT supported in IE8. I downloaded jquery 1.10.2 and using that. Things are working much better now.

Thanks for the help!
 
Old September 24th, 2013, 01:48 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I was just going to suggest that ;-) I am currently updating the book for the upcoming VS 2013 / ASP.NET 4.5.1 releases and I am making note of it there. When you install the jQuery package, you automatically get the latest 2.x branch, so this is something to be aware of.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
slynn (September 24th, 2013)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 11, page 378 - Jquery janilane BOOK: Beginning ASP.NET 4 : in C# and VB 8 January 11th, 2015 06:15 PM
jQuery from Chapter 11 akumok BOOK: Beginning ASP.NET 4 : in C# and VB 1 July 16th, 2012 12:05 PM
Chapter 11 - All jQuery selectors return a collection ? Antonius Block BOOK: Beginning ASP.NET 4 : in C# and VB 1 March 17th, 2012 04:17 PM
Problem with jquery ch 11 nzg5 BOOK: Beginning ASP.NET 4 : in C# and VB 16 February 25th, 2012 10:49 PM
JQuery Troubles- Chapter 11, Exercise 1 Princess Rose BOOK: Beginning ASP.NET 4 : in C# and VB 6 May 3rd, 2010 05:35 PM





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