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

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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 November 26th, 2015, 12:31 PM
Registered User
 
Join Date: Nov 2015
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 7, Why ToLower() for page.theme

I'm looking at the frontend.master.cs file. The switch statement to alternate menu and treeview between themes uses:
[ switch (Page.Theme.ToLower()) /] and then [ case "darkgrey": /] to select the css file.

Could anyone explain why this is better than simply:

[switch (Page.Theme) ]
with [ case "DarkGrey": /] ?
 
Old November 27th, 2015, 01:11 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That would work, if the value for the theme in the drop down was exactly DarkGrey. I typically use a lower case compare (using ToLower, or using string.Equals with an IgnoreCase option) to make the comparison case insensitive.

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!
The Following User Says Thank You to Imar For This Useful Post:
robk (November 27th, 2015)
 
Old November 27th, 2015, 09:46 PM
Registered User
 
Join Date: Nov 2015
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Ok, thanks Imar





Similar Threads
Thread Thread Starter Forum Replies Last Post
Page.Theme UDO_67 BOOK: Beginning ASP.NET 4.5 : in C# and VB 3 February 28th, 2013 04:14 PM
Apply page theme ryanburnett BOOK: Beginning ASP.NET 4 : in C# and VB 20 September 17th, 2010 09:51 AM
Page Theme not sticking... gymwalker ASP.NET 3.5 Basics 4 November 14th, 2008 04:17 PM
page theme zhugeliang ASP.NET 2.0 Basics 1 January 9th, 2007 02:40 AM
ToLower mauiboy VB.NET 2002/2003 Basics 4 January 14th, 2005 04:40 PM





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