473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

API to get all themes from APP_Themes ?

WT
Hello,

I need to list all available themes for a .NET app, is there any API in
..NET2 for this or should I explore the folder files using IO methods ?

Thanks for indication
CS
Jan 30 '07 #1
3 2560
Good Aftrenoon,

I'm afraid System.IO is the only friend. You can save some time by looking
at Page class code (here you'll find excellent utility
http://www.aisto.com/roeder/dotnet/)
--
Milosz
"WT" wrote:
Hello,

I need to list all available themes for a .NET app, is there any API in
..NET2 for this or should I explore the folder files using IO methods ?

Thanks for indication
CS
Jan 30 '07 #2
JJ
This is what I use to get an array of the name of all themes:

public static string[] GetThemes()

{

if (HttpContext.Current.Cache["SiteThemes"] != null)

{

return (string[])HttpContext.Current.Cache["SiteThemes"];

}

else

{

string themesDirPath = HttpContext.Current.Server.MapPath("~/App_Themes");

string[] themes = Directory.GetDirectories(themesDirPath);

for (int i = 0; i <= themes.Length - 1; i++)

themes[i] = Path.GetFileName(themes[i]);

// cache the array

CacheDependency dep = new CacheDependency(themesDirPath);

HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);

return themes;

}

}

JJ

"WT" <WT@newsgroups.nospamwrote in message
news:uz**************@TK2MSFTNGP04.phx.gbl...
Hello,

I need to list all available themes for a .NET app, is there any API in
.NET2 for this or should I explore the folder files using IO methods ?

Thanks for indication
CS

Jan 30 '07 #3
WT
Thanks.

CS
"JJ" <ab*@xyz.coma écrit dans le message de news:
eR*************@TK2MSFTNGP02.phx.gbl...
This is what I use to get an array of the name of all themes:

public static string[] GetThemes()

{

if (HttpContext.Current.Cache["SiteThemes"] != null)

{

return (string[])HttpContext.Current.Cache["SiteThemes"];

}

else

{

string themesDirPath = HttpContext.Current.Server.MapPath("~/App_Themes");

string[] themes = Directory.GetDirectories(themesDirPath);

for (int i = 0; i <= themes.Length - 1; i++)

themes[i] = Path.GetFileName(themes[i]);

// cache the array

CacheDependency dep = new CacheDependency(themesDirPath);

HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);

return themes;

}

}

JJ

"WT" <WT@newsgroups.nospamwrote in message
news:uz**************@TK2MSFTNGP04.phx.gbl...
>Hello,

I need to list all available themes for a .NET app, is there any API in
.NET2 for this or should I explore the folder files using IO methods ?

Thanks for indication
CS


Jan 30 '07 #4

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

Similar topics

0
by: Robert | last post by:
Hi all, I've got a stylesheet defining 3-column layout using CSS stylesheet. I used to define this stylesheet this way: <link href="Whatever/Style.css" rel="stylesheet" type="text/css" /> and in...
5
by: Jan Hyde | last post by:
I keep reading that there should be a couple of built in themes in the directory ...\Microsoft.NET\Framework\v2.x.xxxxx\ASP.NETClientFiles\Themes I've yet to see any machine with this 'Themes'...
0
by: Jay Jetley | last post by:
Hi, I am using .NET 2.0, themes and an IHttpModule to rewrite urls. The problem I have is that if the path that is typed in has a different number of sub directories then the themes stop...
1
by: rory.groves | last post by:
I expected to run into numerous galleries of ASP.NET 2.0 Themes and Skins, but have come up with NOTHING so far, other than a promise of a theme gallery on www.asp.net that is non-existent. ...
2
by: CK | last post by:
Hello All, I am trying to extend the default asp:ImageButton to include an image for an enabled state and a second image for a disabled state. I currently did this by extending the ImageButton...
2
by: mike | last post by:
Hi. I am having trouble grasping the concept of applying a consistent theme to an ASP.net website. I didn't used to like ASP because it was too hard to apply a theme from a common theme folder like...
1
by: archana | last post by:
Hi all, I have just using dot net studio 2005. I am careating one theme. Here global themse are getting stored at 2 location. \Microsoft.NET\Framework\<version>\ASP.NETClientFiles\Themes....
2
by: Clint Chapman | last post by:
When I look at the source html generated from my asp, the links for the css in my theme are duplicated to include files in the _vti_cnf. <link...
1
by: Cramer | last post by:
According to the MSDN docs, we cannot programatically create our own themes or skins: "Page and control developers do not use the ControlSkinDelegate, ControlSkin, or PageTheme classes directly....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.