public void InstantiateIn(Control container) { PlaceHolder ph = new PlaceHolder(); container.Controls.Add(ph); Control c = GetCtrl(ph); PostMetaWordList wplCat = (PostMetaWordList)cu.FindControl("wplCat", c); PostMetaWordList wpltag = (PostMetaWordList)cu.FindControl("wpltag", c); wplCat.DataBinding += new EventHandler(pmwlList_DataBinding); wpltag.DataBinding += new EventHandler(pmwlList_DataBinding); ph.Controls.Add(c); }
protected PagedDataNextPrevLinkPair FindPrevNextCtrl(string sCtrlName) { PagedDataNextPrevLinkPair pair = new PagedDataNextPrevLinkPair(); try { ControlUtilities cu = new ControlUtilities(this.Page); Control ctrl = cu.FindControl(sCtrlName, this.Page); pair.LinkWrapper = (PagedDataNextPrevLinkWrapper)ctrl; if (pair.LinkWrapper == null) { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(sCtrlName, this.Page); } else { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(typeof(PagedDataNextPrevLink), pair.LinkWrapper); } } catch (Exception ex) { } return(pair); }
protected override void OnPreRender(EventArgs e) { this.SetText(); if (!this.UseDefaultText) { ControlUtilities cu = new ControlUtilities(this.Page); PagedDataNextPrevText txt = (PagedDataNextPrevText)cu.FindControl(typeof(PagedDataNextPrevText), this); if (txt != null) { txt.NavDirection = this.NavDirection; } } base.OnPreRender(e); }
protected override void OnPreRender(EventArgs e) { this.SetText(); if (!this.UseDefaultText) { ControlUtilities cu = new ControlUtilities(this.Page); PagedDataNextPrevText txt = (PagedDataNextPrevText)cu.FindControl(typeof(PagedDataNextPrevText), this); if (txt != null) { txt.NavDirection = this.NavDirection; } } base.OnPreRender(e); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); //this.ControlPath = this.WidgetSettings.ControlPath; //this.ControlTitle = this.WidgetSettings.ControlPath; //this.Order = this.WidgetSettings.WidgetOrder; this.DatabaseKey = this.WidgetData.Root_WidgetID; if (!this.WidgetData.IsWidgetActive) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.InactivePagePrefix, this.ControlTitle); } if (this.WidgetData.IsRetired) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.RetiredPagePrefix, this.ControlTitle); } if (this.WidgetData.IsUnReleased) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.UnreleasedPagePrefix, this.ControlTitle); } if (this.WidgetData.IsWidgetPendingDelete) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.PendingDeletePrefix, this.ControlTitle); } if (SiteData.IsWebView) { ControlUtilities cu = new ControlUtilities(); if (this.IsAdminMode) { ctrl1 = GetCtrl("ucAdminWidget1", this); ctrl2 = GetCtrl("ucAdminWidget2", this); if (this.JSEditFunctions != null && this.JSEditFunctions.Any()) { PlaceHolder phMenuItems = (PlaceHolder)cu.FindControl("phMenuItems", ctrl1); foreach (KeyValuePair <string, string> f in this.JSEditFunctions) { Control itm = GetCtrl(this, f.Key, f.Value); phMenuItems.Controls.Add(itm); } this.JSEditFunction = null; } HtmlGenericControl remove = (HtmlGenericControl)cu.FindControl("liRemove", ctrl1); HtmlGenericControl act = (HtmlGenericControl)cu.FindControl("liActivate", ctrl1); act.Visible = !this.WidgetData.IsWidgetActive; remove.Visible = this.WidgetData.IsWidgetActive; if (String.IsNullOrEmpty(this.JSEditFunction)) { HtmlGenericControl edit = (HtmlGenericControl)cu.FindControl("liEdit", ctrl1); HtmlGenericControl hist = (HtmlGenericControl)cu.FindControl("liHistory", ctrl1); edit.Visible = false; hist.Visible = false; } } else { ctrl1 = new Literal { Text = "<span style=\"display: none;\" id=\"BEGIN-" + this.ClientID + "\"></span>\r\n" }; ctrl2 = new Literal { Text = "<span style=\"display: none;\" id=\"END-" + this.ClientID + "\"></span>\r\n" }; } } }
protected override void Render(HtmlTextWriter writer) { this.EnsureChildControls(); if (this.TextZone != TextFieldZone.Unknown && (String.IsNullOrEmpty(this.Text) || this.DatabaseKey == Guid.Empty)) { ContentPage pageContents = cu.GetContainerContentPage(this); if (pageContents != null) { this.DatabaseKey = pageContents.Root_ContentID; this.IsAdminMode = SecurityData.AdvancedEditMode; switch (this.TextZone) { case TextFieldZone.TextLeft: this.ZoneChar = "l"; this.Text = pageContents.LeftPageText; break; case TextFieldZone.TextCenter: this.ZoneChar = "c"; this.Text = pageContents.PageText; break; case TextFieldZone.TextRight: this.ZoneChar = "r"; this.Text = pageContents.RightPageText; break; default: break; } } } Control ctrl = new Control(); string outputText = SiteData.CurrentSite.UpdateContent(this.Text); if (IsAdminMode) { ctrl = GetCtrl(this); Literal lit = (Literal)cu.FindControl("litContent", ctrl); lit.Text = outputText; } else { #if DEBUG ctrl.Controls.Add(new Literal { Text = "\r\n<span style=\"display: none;\" id=\"BEGIN-" + this.ClientID + "\"></span>" }); #endif ctrl.Controls.Add(new Literal { Text = String.Format("\r\n {0} \r\n", outputText) }); #if DEBUG ctrl.Controls.Add(new Literal { Text = "<span style=\"display: none;\" id=\"END-" + this.ClientID + "\"></span>\r\n" }); #endif } ctrl.RenderControl(writer); }
protected PagedDataNextPrevLinkPair FindPrevNextCtrl(string sCtrlName) { PagedDataNextPrevLinkPair pair = new PagedDataNextPrevLinkPair(); try { ControlUtilities cu = new ControlUtilities(this.Page); Control ctrl = cu.FindControl(sCtrlName, this.Page); pair.LinkWrapper = (PagedDataNextPrevLinkWrapper)ctrl; if (pair.LinkWrapper == null) { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(sCtrlName, this.Page); } else { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(typeof(PagedDataNextPrevLink), pair.LinkWrapper); } } catch (Exception ex) { } return pair; }
private Repeater GetCtrl(Control ctrl) { Repeater r = new Repeater(); try { ControlUtilities cu = new ControlUtilities(ctrl); Control userControl = cu.CreateControlFromResource("Carrotware.CMS.UI.Controls.ucFancyPager.ascx"); r = (Repeater)cu.FindControl("rpPager", userControl); } catch { } return r; }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); //this.ControlPath = this.WidgetSettings.ControlPath; //this.ControlTitle = this.WidgetSettings.ControlPath; //this.Order = this.WidgetSettings.WidgetOrder; this.DatabaseKey = this.WidgetData.Root_WidgetID; if (!this.WidgetData.IsWidgetActive) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.InactivePagePrefix, this.ControlTitle); } if (this.WidgetData.IsRetired) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.RetiredPagePrefix, this.ControlTitle); } if (this.WidgetData.IsUnReleased) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.UnreleasedPagePrefix, this.ControlTitle); } if (this.WidgetData.IsWidgetPendingDelete) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.PendingDeletePrefix, this.ControlTitle); } if (SiteData.IsWebView) { ControlUtilities cu = new ControlUtilities(); if (this.IsAdminMode) { ctrl1 = GetCtrl("ucAdminWidget1", this); ctrl2 = GetCtrl("ucAdminWidget2", this); if (this.JSEditFunctions != null && this.JSEditFunctions.Any()) { PlaceHolder phMenuItems = (PlaceHolder)cu.FindControl("phMenuItems", ctrl1); foreach (KeyValuePair<string, string> f in this.JSEditFunctions) { Control itm = GetCtrl(this, f.Key, f.Value); phMenuItems.Controls.Add(itm); } this.JSEditFunction = null; } HtmlGenericControl remove = (HtmlGenericControl)cu.FindControl("liRemove", ctrl1); HtmlGenericControl act = (HtmlGenericControl)cu.FindControl("liActivate", ctrl1); act.Visible = !this.WidgetData.IsWidgetActive; remove.Visible = this.WidgetData.IsWidgetActive; if (String.IsNullOrEmpty(this.JSEditFunction)) { HtmlGenericControl edit = (HtmlGenericControl)cu.FindControl("liEdit", ctrl1); HtmlGenericControl hist = (HtmlGenericControl)cu.FindControl("liHistory", ctrl1); edit.Visible = false; hist.Visible = false; } } else { ctrl1 = new Literal { Text = "\r\n" }; ctrl2 = new Literal { Text = "\r\n" }; #if DEBUG ctrl1 = new Literal { Text = "<span style=\"display: none;\" id=\"BEGIN-" + this.ClientID + "\"></span>\r\n" }; ctrl2 = new Literal { Text = "<span style=\"display: none;\" id=\"END-" + this.ClientID + "\"></span>\r\n" }; #endif } } }