Пытаюсь внедрить CMS пивной (ASP.NET 2.0 Программирование веб-сайтов: проблема - дизайн - решение), я сталкиваюсь с проблемой во второй главе при реализации тем.
Проблема здесь в том, что даже когда я выбираю белый цвет в качестве темы, он остается по умолчанию, хотя происходит обратная передача, он остается белым. Я также применил точку останова, вот эта. Страница. Тема всегда белая.
Может кто-нибудь помочь мне выяснить, в чем проблема.
Темы вызываются из класса помощника
//This is the helper class
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");
// get the array of themes folders under /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 with a dependency to the folder
CacheDependency dep = new CacheDependency(themesDirPath);
HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);
return themes;
}
}
И выпадающий список связан с классом помощника через пользовательский элемент управления
protected void Page_Load(object sender, EventArgs e)
{
if (Globals.ThemesSelectorID.Length == 0)
Globals.ThemesSelectorID = ddlThemes.UniqueID;
ddlThemes.DataSource = Helpers.GetThemes();
ddlThemes.DataBind();
ddlThemes.SelectedValue = this.Page.Theme;
}
Я разработал темы, одна по умолчанию, а другая белая, и объявлена в разделе страниц в
web.config.
<pages theme="Default" masterPageFile="~/MyCMSMaster.master">