Wrox Programmer Forums
|
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 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 July 18th, 2012, 04:18 PM
Authorized User
 
Join Date: Jan 2009
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
Post Exercise 1 from Ch 11

jQuery script below

if ($(this).css('display') == 'block')

"this" referring to new span HideBanner. I was reading from other sources on Internet default value for 'display' property of <span> is 'inline'. So what cause
to change it to 'block'? Thanks
 
Old July 19th, 2012, 02:59 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> So what cause to change it to 'block'?

Nothing ;-)

The answer in Appendix B is not correct. You can find an updated version in the errata:

http://www.wrox.com/WileyCDA/WroxTit...Cd-ERRATA.html

(Scroll all the way to the end of the page).

The code is now in a callback where this refers the the panel whose display property is affected by the call to slideToggle.

Hope this helps,

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 July 19th, 2012, 10:14 AM
Authorized User
 
Join Date: Jan 2009
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
Default 2 pieces of code

2 pieces of code totally identical, I copied both into Code Compare utility, just to make sure, no single difference was found. But this is not my question. My question was, when we are checking the value of the 'display' property we're comparing against 'block'. At the same time I was reading everywhere the default value of 'display' property for <span> element is 'inline' and for <div> is indeed 'block'. So can you explain where we're setting 'display' to be equal 'block' for our newly created <span id="HideBanner">. Thanks
 
Old July 19th, 2012, 10:29 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,

Quote:
So can you explain where we're setting 'display' to be equal 'block' for our newly created <span id="HideBanner">.
Again: nowhere.

Looks like you didn't understand my answer, or the code I linked to in the appendix.

The new code now uses a callback. This changes "this" to be the Panel (instead of the HideBanner element) which is a div (instead of a span) which has its display set to block by default. slideToggle then alternates between none and block.

Does this clarify things?

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 July 19th, 2012, 11:14 AM
Authorized User
 
Join Date: Jan 2009
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Got it! I was completely lost (insane). Obviously, this referring to panel and panel sits inside <div> and default for 'display' for <div> is 'block'. Sorry for being idiot :)
 
Old July 19th, 2012, 11:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, exactly, Or actually: almost. A Panel *is* a <div> rather than that it contains one. It renders as a <div> element at the cliient.

Glad to hear it's making sense now ;-)

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 July 19th, 2012, 11:31 AM
Authorized User
 
Join Date: Jan 2009
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Your book is tremendous, thanks a lot. It makes me believe, hard core client/server guy, I can write ASP.NET code one day as easily as something I've done for the past 15 years
 
Old July 20th, 2012, 02:17 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome. Good to hear you find it so useful, and good luck!

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 11, Exercise 3 GetOldest() Method malie22001 BOOK: Beginning Visual C# 2010 0 June 13th, 2012 01:35 PM
chapter 11 exercise 1(page401) stram BOOK: Beginning ASP.NET 4 : in C# and VB 13 December 28th, 2011 12:30 AM
JQuery Troubles- Chapter 11, Exercise 1 Princess Rose BOOK: Beginning ASP.NET 4 : in C# and VB 6 May 3rd, 2010 05:35 PM
Ch 11 Pg459 Exercise 5 C# brivad BOOK: Beginning ASP.NET 1.0 0 September 10th, 2007 08:59 AM





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