Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

User-Specified Themes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jonathan Wood - 18 Dec 2007 04:39 GMT
If I want each user to be able to specify their own themes, does that mean I
must set the theme in an even handler (such as PreInit) for every single
page?

I suppose I could cache the user's theme in the Session object. But I
wondered if there was any shortcut to having to set the theme in the PreInit
event for every single page.

Thanks.

Signature

Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Michael Nemtsev [MVP] - 18 Dec 2007 09:23 GMT
Hello Jonathan,

yes u  must

see there http://quickstarts.asp.net/QuickStartv20/aspnet/doc/themes/personalization.aspx

---
WBR,
Michael  Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour 

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

JW> If I want each user to be able to specify their own themes, does
JW> that mean I must set the theme in an even handler (such as PreInit)
JW> for every single page?
JW>
JW> I suppose I could cache the user's theme in the Session object. But
JW> I wondered if there was any shortcut to having to set the theme in
JW> the PreInit event for every single page.
JW>
JW> Thanks.
JW>
Jonathan Wood - 18 Dec 2007 16:56 GMT
Thanks!

Signature

Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

> Hello Jonathan,
>
[quoted text clipped - 18 lines]
> JW> JW> Thanks.
> JW>
Scott Roberts - 18 Dec 2007 18:16 GMT
> But I wondered if there was any shortcut to having to set the theme in the
> PreInit event for every single page.

You can set the theme in Application_PreRequestHandlerExecute in
global.asax:

private void Application_PreRequestHandlerExecute(Object sender, EventArgs
e)
{
 HttpContext CurrentContext = HttpContext.Current;
 Page p = ( CurrentContext.Handler as Page );
 if ( null != p )
 {
    p.Theme = "Default";
  }
 }
}
Jonathan Wood - 18 Dec 2007 19:00 GMT
That's cool if that will work.

One thing: my plan is to cache the user's theme in the Session object. So
this code will need to be able to access both the Session object and some
database code. I assume the database code will work but now I wonder if the
Session object will be available. I would also need to get info for the
current user, which may not be set up either.

I'll have to play around with that.

Thanks.

Signature

Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

>> But I wondered if there was any shortcut to having to set the theme in
>> the PreInit event for every single page.
[quoted text clipped - 13 lines]
>  }
> }
Scott Roberts - 18 Dec 2007 19:06 GMT
The Session and User are both populated and available on the CurrentContext.

> That's cool if that will work.
>
[quoted text clipped - 25 lines]
>>  }
>> }
Jonathan Wood - 18 Dec 2007 19:44 GMT
Cool. Thanks!

Signature

Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

> The Session and User are both populated and available on the
> CurrentContext.
[quoted text clipped - 28 lines]
>>>  }
>>> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.