473,837 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Http Context.Current .Response.Write ("Hello World!");
LoL

Well Any Help is Appreciated,
-Norman
Jun 28 '07 #1
3 1926
"Norman Wooten @yahoo.com>" <wooten26<remov ethiswrote 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...@markNOSPA Mrae.netwrote:
"Norman Wooten @yahoo.com>" <wooten26<remov ethiswrote in messagenews: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
Hi...

take a look at this code

(System.Web.Htt pContext.Curren t.Handler as System.Web.UI.P age).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)HttpConte xt.Current.Hand ler;

// Then Can Access Like
HttpContext.Cur rent.Response.W rite(Testing.Th eme);

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.Htt pContext.Curren t.Handler as System.Web.UI.P age).Theme;

you can access your theme any where :)

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

Jun 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2303
by: Miguel Dias Moura | last post by:
Hello, I am creating a master page for a web site. All pages created from this master page will use the same theme. However I am not able to add the theme in my master page. Why is that? Do I need to add the theme on the top of each page I create from this master page?
0
1724
by: damiensawyer | last post by:
Hello all, I'm very new to all of this. I have a theme and a skin (the standard ones). I have a standard master page which is holding a custom ascx which has a treeview in it. Can someone please point me in the right direction to bind a theme to the treeview? The 'theme' tag is on the <%@ page %> directive... however neither my master page or ASCX files use this. They use <%Master%> and
3
2878
by: dvan | last post by:
I've created a theme Css for my Asp.net 2.0 web application. The web.config Pages Theme key is set to the theme name. Everything seams to work fine except for any page that I want to disable the master theme and apply another stylesheet.css. According to the documentation I've read. I should be able to disable the theme by setting the "enabletheming" attribute on the aspx Page to false. This doesn't seam to work. When I look at the...
1
8013
by: Joey | last post by:
Hello, I have tried to programmatically set the theme for my master page by putting code in a "Page_PreInit" fuction in the master page's code behind. However, when I set a breakpoint there and run the app, the breakpoint is never hit. Of course my theme is not being applied. The above procedure works fine for any content page, but obviously doesn't work for my master page. So, how does one properly and programmatically set a theme...
3
1156
by: Mr Flibble | last post by:
If I have a base page Default.aspx (and Default.aspx.cs). Can I have via ASP.Net inheritance another page derived from Default.aspx(and .cs) as it's base class and then override the Stylesheet declaration (amongst other things)?? I have two pages that are identical bar the Stylesheet and so far I have to maintain two pages to achieve this. It would be nice to maintain just ONE page but have its various styles displayed under different...
7
2411
by: GaryDean | last post by:
In my old 1.1 apps the default was MS_POSITIONING="GridLayout" and Textboxes and labels and such always had POSITION: absolute; and I never had any distortion when the page was rendered. Life was good. now in 2.0 I'm using the default placeholder and putting a table in the placeholder and putting controls in the cells in the table. "the way it is supposed to be done" I have a textbox in a table that is defined as follows... <td...
4
1516
by: JJ | last post by:
My master page contains various graphics that are referenced from the images folder. As long as the container pages are at the same level (ie. the top level looking at the solution explorer in Visual studio 2005) as the master page, the images appear correctly. However, the images do not appear when I am using a container file within a directory. Do I need to use links that aren't relative to the master page so that any content page...
2
3309
by: Marc | last post by:
I am studying a bit and I have encountered some reading stuff about skin files, css files and themes in asp.net. To me the name of the StyleSheetTheme page attribute has little a no connection with CSS files, StyleSheets. It's a level of precedence lower then the page attribute 'Theme'. Both attributes refer to the name of a Theme folder that contains skins and css files. But 'StyleSheetTheme' could iqually be named something like...
1
2895
by: Sushmitha | last post by:
Please help me, this is really bugging since a week. I have a code that says: <DIV CLASS ="SLIDETABS"> <ul id="solutionstabs" class="tabs"> <li ><a href="#" title="Solution Overviews" rel="solutions1" ><span>Solution Overviews</span></a></li> <li ><a href="#" title="Implementation Accelerators" rel="solutions2" ><span>Implementation Accelerators</span></a></li> <li ><a href="#" title="Customer...
0
9833
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10867
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10562
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10617
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5842
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4469
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3122
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.