Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 March 22nd, 2009, 04:24 AM
Authorized User
 
Join Date: Mar 2009
Posts: 75
Thanks: 16
Thanked 1 Time in 1 Post
Default Selecting Theme (chpater 2)

Hello,
I've began learning from this great book and have a question regarding theme selection , mechanism presented in chapter 2.

In this chapter suggested to use static property ThemesSelectorID to store the UniqueID of the listbox and to use Request.Form["__EVENTTARGET"] for retrieving the actual data from the listbox.

My question is why can't I just use this global static string to store the selected theme?

Thnaks
 
Old March 22nd, 2009, 08:58 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Hi Yevi,

As ThemesSelectorID is a global static string, it is tied to the whole Application, not each user session - every session can read and update the same bit of data. In this way, static variables work in a very similar way to the Application object in ASP3, but are far more efficient (http://www.devx.com/vb2themax/Tip/18845)

If you stored the name of the theme as a static string, one person could set the theme to TemplateMonster, but the next person who visits a page will also get the TemplateMonster theme. We want the ID of the control to be the same for everyone, not the name of the theme. Using Session directly or indirectly, as shown in BasePage.cs, is really the only way to store per-user settings.

HTH
Phil

Last edited by philip_cole; March 22nd, 2009 at 09:10 AM..
 
Old March 22nd, 2009, 11:50 AM
Authorized User
 
Join Date: Mar 2009
Posts: 75
Thanks: 16
Thanked 1 Time in 1 Post
Default

Great answer.
Know i understand that static var is tied to all sessions.
Thank you!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Theme not sticking... gymwalker ASP.NET 3.5 Basics 4 November 14th, 2008 04:17 PM
Exception of get theme JasonF430 ASP.NET 2.0 Basics 0 April 16th, 2008 01:31 AM
Theme Selector wont pick up other theme Tawanda BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 May 4th, 2007 08:44 AM
theme selector rav BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 February 12th, 2007 12:44 AM
page theme zhugeliang ASP.NET 2.0 Basics 1 January 9th, 2007 02:40 AM





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