 |
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
|
|
|
|
|

July 18th, 2012, 04:18 PM
|
|
Authorized User
|
|
Join Date: Jan 2009
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 19th, 2012, 02:59 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
>> 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
|
|

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

July 19th, 2012, 10:29 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

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

July 19th, 2012, 11:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

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

July 20th, 2012, 02:17 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome. Good to hear you find it so useful, and good luck!
Imar
|
|
 |
|