Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old June 24th, 2014, 12:21 PM
Registered User
Points: 28, Level: 1
Points: 28, Level: 1 Points: 28, Level: 1 Points: 28, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 11: Enabling Unobtrusive JavaScript Validation

I'm following along in the book, and I got the last Try It Out exercise in Chapter 11: Enabling Unobtrusive JavaScript Validation. I followed all the steps, at least I think so, but when I do step 10, 'testing step', and I click send, no validation code is run and the website throws an error because the empty email field got passed to the code behind.

I ran the source code that I downloaded for the book and it seems to work correctly. So I copied and pasted, one by one, all of the code that I thought was relevant for the current exercise, and of course changed the jquery version from 1.7.2(source website) to 2.1.1(my website). After trying each file, I still couldn't get the form to validate.

I discovered that the only way I can re-enable validation was to change:
Code:
<add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms"/>
back to:
Code:
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
Did an update break this functionality, or is it just likely I missed something?
Of course any help is appreciated.

Since I'm using that workaround, i'll just continue to the next chapter, but I would like to know what I did wrong. If I need to, I can give hastebin links for my code to be examined.
  #2 (permalink)  
Old June 25th, 2014, 10:00 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You may have run into a know issue. Can you look into this thread and see if that fixes it for you?

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!
  #3 (permalink)  
Old June 25th, 2014, 06:22 PM
Registered User
Points: 28, Level: 1
Points: 28, Level: 1 Points: 28, Level: 1 Points: 28, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you forgot to add a hyperlink, but I think you were going to say this thread.
Installing the package and adding it to the script manager did fix the issue

Thank You
  #4 (permalink)  
Old June 25th, 2014, 10:56 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, yes, I meant that thread indeed. I was at a conference and posting this reply in between presenting and attending a session so it was a bit rushed ;-)

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!
  #5 (permalink)  
Old March 10th, 2016, 06:36 PM
Authorized User
Points: 103, Level: 2
Points: 103, Level: 2 Points: 103, Level: 2 Points: 103, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2015
Location: Annandale, VA
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default Unobtrusive Java Script not working

I've advanced through Chapter 11 with a few problems which I was eventually able to resolve. The site works as described in "Beginning ASP.NET 4.5.1 in C# and VB". However, upon completing the final "Try It", and upon viewing the page source in the browser (both Google Chrome & IE 11.0) I noted the bloated HTML was still present. I ran the example for chapter 11, downloaded from the WROX web site, and all worked as it should, the bloated HTML was gone. I then coped each line from the downloaded chapter into my code: the bloated HTML remained. I checked the "WebForms" folder in the "Scripts" folder and all the files in the example for chapter 11 were also present in my sites "WebForms" folder.

The major difference between my Site and that described for the Book are:

I'm using Visual Studio 2013.
The jquery version I'm using is jquery-2.2.1 vs jquery-2.0.3

Because of these differences, is there something more I should be doing to get "unobtrusive javascript" to work (elimenate the bloated HTML)?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 11 - p.372 - Ready function and AJAX/Javascript Tulsi BOOK: Beginning ASP.NET 4 : in C# and VB 1 May 5th, 2014 04:06 PM
Ch 11 jQuery unobtrusive javascript stopped the ShowMessageBox AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 9 March 6th, 2014 07:19 AM
Chapter 19, Page 555, Turning off unobtrusive validation Drogil BOOK: Beginning Visual C# 2012 0 November 18th, 2013 03:33 PM
chapter 11 figure 11-7 relative positioning pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 November 29th, 2007 06:11 AM





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