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

Discussion in 'ASP .Net' started by Norman Wooten, Jun 28, 2007.

  1. 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("Hello World!");
    LoL

    Well Any Help is Appreciated,
    -Norman
     
    Norman Wooten, Jun 28, 2007
    #1
    1. Advertising

  2. Norman Wooten

    Mark Rae Guest

    "Norman Wooten @yahoo.com>" <wooten26<removethis> wrote in message
    news:...

    > 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
     
    Mark Rae, Jun 28, 2007
    #2
    1. Advertising

  3. Norman Wooten

    Masudur Guest

    On Jun 28, 2:40 pm, "Mark Rae" <> wrote:
    > "Norman Wooten @yahoo.com>" <wooten26<removethis> wrote in messagenews:...
    >
    > > 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/
     
    Masudur, Jun 28, 2007
    #3
  4. 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/
    >
     
    Norman Wooten, Jun 28, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Dong
    Replies:
    0
    Views:
    471
    Tony Dong
    Dec 20, 2005
  2. Sachin
    Replies:
    3
    Views:
    875
    Alan Silver
    Mar 1, 2006
  3. =?Utf-8?B?ZHZhbg==?=

    Disable Asp.Net 2.0 Theme at page level

    =?Utf-8?B?ZHZhbg==?=, Apr 13, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    9,381
    Nizar.Hejazi
    Mar 10, 2009
  4. shapper
    Replies:
    1
    Views:
    510
    aejw.com
    Nov 25, 2006
  5. Apope56

    ASP.NET Theme ignored

    Apope56, Mar 8, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    389
    Apope56
    Mar 10, 2008
Loading...

Share This Page