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 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 Search this Thread Display Modes
  #1 (permalink)  
Old December 3rd, 2011, 03:29 PM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble with jQuery try it out p.370

I am seeing two problems, but I hope they are related.
1) Where I have entered the <Scripts></Scripts> element it shows that it is not supported/known.
2) When I try to open the Demo/jQuery.aspx page is says that the $ at line 86 is undefined.
I include code from both pages below.
Thank you for any help you provide.
Code:
<%@ Page Title="jQuery Demo" Language="VB" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="false" CodeFile="jQuery.aspx.vb" 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>
AND

Code:
<%@ Master Language="VB" CodeFile="Frontend.master.vb" Inherits="MasterPages_Frontend" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
     <asp:ScriptManager runat="server" ID="ScriptManager1" EnablePageMethods="True" />
     <Scripts>
      <asp:ScriptReference Path="~/Scripts/jquery-1.4.1.min.js" />
     </Scripts>
       <div id="PageWrapper">
          <div id="Header"><a href="~/" runat="server"></a></div>
          <div id="MenuWrapper">
            <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>
          </div>           
          <div id="MainContent">
             <asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath><br /><br />
             <asp:ContentPlaceHolder ID="cpMainContent" runat="server">
             </asp:ContentPlaceHolder>              
          </div>
          <div id="Sidebar">Select Theme Here<br /><asp:dropdownlist runat="server" 
                  ID="ThemeList" AutoPostBack="True">
              <asp:ListItem>DarkGrey</asp:ListItem>
              <asp:ListItem>Monochrome</asp:ListItem>
              </asp:dropdownlist>
              <br />
              <br />
              <br />
              <Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Vertical" />              
           </div>
          <div id="Footer">Footer Goes Here</div>
       </div>
    </form>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old December 4th, 2011, 06:11 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Are you sure your jQuery file exists in the Scripts folder? Take a look at the final HTML in the browser for the full path to the script file. Then try to request that in the browser directly. Does the file appear OK or do you get an error? E.g. browse to something like http://localhost:12345/Scripts/jquery-1.4.1.min.js. Don't forget to update the complete URL to match your setup.

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!
Reply With Quote
  #3 (permalink)  
Old December 4th, 2011, 06:34 AM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Looks good to me, but error happens.

The error does appear when I try to navigate straight to the file, but the file is in the Scripts folder directly off the root of the site?
I took some screen shots, but I don't see a way to insert them here...
I believe you have me going the right path and that this will be a simple error on my part, but the file (including) syntax looks correct...other thoughts?

Thanks again Imar.
Reply With Quote
  #4 (permalink)  
Old December 4th, 2011, 06:50 AM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default My error as expected

I still haven't been able to see what I missed, but I copied the text required for this TIO from the source directly into my files and the exercise works.
I will try one vs the other next and see if I can narrow the error location.

Thanks for your support.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 11 try it out p.370 Mohammed87 BOOK: Beginning ASP.NET 4 : in C# and VB 2 September 14th, 2011 05:40 PM
Chapter 11 - Try it Out Pg. 370 ISE1988 BOOK: Beginning ASP.NET 4 : in C# and VB 4 October 11th, 2010 03:12 PM
Trouble registering jquery accordion on code behind ysfkay ASP.NET 3.5 Professionals 0 March 11th, 2010 08:14 AM
Page 370 - New ContextMenu MajorD BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 2 July 25th, 2007 10:26 AM
Code snippet error on page 370 cebartling BOOK: Professional Java Development with the Spring Framework 0 September 18th, 2005 10:00 PM



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


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