469,963 Members | 2,138 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

ASP.NET/C# 2.0 - Getting the page's theme in a class

Ok, I am a nOOb C#/NET coder, so this is probably easy.. heh heh (only been
pecking is these languages for a week now, just converted from vbscript and
classic asp)

But anyways, I have a class library - and wish to be able to determine the
currently loaded theme for the calling webpage programaticly.. I can do this
in the code-behind using page.theme - but can not in the class library (for
whatever small reason I am missing)..

Hope I am explaining myself clearly :))

But again, I am complete utter nOOb right now.. took me an hour to figure
out how to use a response.write in the class library..
System.Web.HttpContext.Current.Response.Write("Hel lo World!");
LoL

Well Any Help is Appreciated,
-Norman
Jun 28 '07 #1
3 1815
"Norman Wooten @yahoo.com>" <wooten26<removethiswrote in message
news:hY******************************@comcast.com. ..
Ok, I am a nOOb C#/NET coder, so this is probably easy.. heh heh (only
been pecking is these languages for a week now, just converted from
vbscript and classic asp)

But anyways, I have a class library - and wish to be able to determine the
currently loaded theme for the calling webpage programaticly.. I can do
this in the code-behind using page.theme - but can not in the class
library (for whatever small reason I am missing)..

Hope I am explaining myself clearly :))
Why not just pass Page.Theme as a parameter to the method(s) in your class
which need it...?
--
http://www.markrae.net

Jun 28 '07 #2
On Jun 28, 2:40 pm, "Mark Rae" <m...@markNOSPAMrae.netwrote:
"Norman Wooten @yahoo.com>" <wooten26<removethiswrote in messagenews:hY******************************@comca st.com...
Ok, I am a nOOb C#/NET coder, so this is probably easy.. heh heh (only
been pecking is these languages for a week now, just converted from
vbscript and classic asp)
But anyways, I have a class library - and wish to be able to determine the
currently loaded theme for the calling webpage programaticly.. I can do
this in the code-behind using page.theme - but can not in the class
library (for whatever small reason I am missing)..
Hope I am explaining myself clearly :))

Why not just pass Page.Theme as a parameter to the method(s) in your class
which need it...?

--http://www.markrae.net
Hi...

take a look at this code

(System.Web.HttpContext.Current.Handler as System.Web.UI.Page).Theme;

you can access your theme any where :)

Thanks
Munna
http://munnacs.110mb.com/

Jun 28 '07 #3
Ok, finally figuered it out with your help! This what I came up with:

// Using Namespaces
using System.Web;
using System.Web.UI;

// Variable Declaration
private Page Testing = new Page();

// Casting
Testing = (Page)HttpContext.Current.Handler;

// Then Can Access Like
HttpContext.Current.Response.Write(Testing.Theme);

If there is more streamlined way to Declare/cast on one line or something..
lol.. but I am happy with result anyways :))
Hi...

take a look at this code

(System.Web.HttpContext.Current.Handler as System.Web.UI.Page).Theme;

you can access your theme any where :)

Thanks
Munna
http://munnacs.110mb.com/

Jun 28 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Miguel Dias Moura | last post: by
reply views Thread by damiensawyer | last post: by
3 posts views Thread by dvan | last post: by
3 posts views Thread by Mr Flibble | last post: by
7 posts views Thread by GaryDean | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.