Language: C#
ResolveThemeUrl
/// <summary> /// Returns an application Url that's Theme relative. /// images/users.gif /// returns: /myapp/app_themes/{activetheme}/images/users.gif /// </summary> public static string ResolveThemeUrl(string themeRelativePath) { string theme = null; // try to pick up active theme Page page = HttpContext.Current.Handler as Page; if (page != null) theme = page.Theme; // if not available use config default if (!string.IsNullOrEmpty(theme)) theme = App.Configuration.Theme; return HttpContext.Current.Request.ApplicationPath + "/".Replace("//", "") + "app_themes/" + theme + "/" + themeRelativePath; }
Tags:
Description:
Useful to embedding theme relative links to css and theme specific images. <%= ResolveThemeUrl("images/user.gif") %>.
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

