/// <summary> /// Creates the child controls tree. /// </summary> private void CreateChildControlsTree() { if (!String.IsNullOrEmpty(Code)) { System.Web.UI.Control ctrl = null; string id = "Template" + this.ID; ctrl = ProductInfoHolder.FindControl(id); if (ctrl == null) { CatalogEntryDto dto = CatalogContext.Current.GetCatalogEntryDto(Code); string templateUrl = GetTemplateUrl(dto.CatalogEntry[0].TemplateName); if (String.IsNullOrEmpty(templateUrl)) { throw new System.NullReferenceException(String.Format("CatalogEntry \"{0}\" does not have display template specified.", Code)); } try { ctrl = this.LoadControl(templateUrl.ToString()); if (ctrl is IContextUserControl) { IDictionary dic = new ListDictionary(); dic.Add("Code", Code); dic.Add("NodeCode", NodeCode); dic.Add("CatalogName", CatalogName); dic.Add("Depository", this.Depository); ((IContextUserControl)ctrl).LoadContext(dic); } } catch (HttpException ex) { if (ex.GetHttpCode() == 404) { throw new System.IO.FileNotFoundException("Template not found", ex); } else { throw; } } this.ProductInfoHolder.Controls.Add(ctrl); Session["LastCatalogPageUrl"] = CMSContext.Current.CurrentUrl; StoreHelper.AddBrowseHistory("Entries", Code); //Profile.LastCatalogPageUrl = CMSContext.Current.CurrentUrl; /* * // Record history * StringCollection historyDic = (StringCollection)Profile["EntryHistory"]; * * // Check if the code already exists * if (historyDic.Contains(Code)) * { * historyDic.RemoveAt(historyDic.IndexOf(Code)); * } * * // Only keep history of last 5 items visited * if (historyDic.Count >= 5) * historyDic.RemoveAt(0); * * historyDic.Add(Code); * * // set value * Profile["EntryHistory"] = historyDic; * */ } } }