protected override void OnInit(EventArgs e) { base.OnInit(e); uxTitlePlaceHolder.Controls.Clear(); uxContentPlaceHolder.Controls.Clear(); ContentContainer container = new ContentContainer(); if (TitleTemplate != null) { TitleTemplate.InstantiateIn(container); uxTitlePlaceHolder.Controls.Add(container); } else { uxTitlePlaceHolder.Visible = false; } container = new ContentContainer(); if (ContentTemplate != null) { ContentTemplate.InstantiateIn(container); uxContentPlaceHolder.Controls.Add(container); } else { uxContentPanel.CssClass = "Clear"; } }
protected override void OnInit(EventArgs e) { this.ContentTemplateContainer = new HtmlGenericControl("div"); if (ContentTemplate != null) { ContentTemplate.InstantiateIn(container); } plcContent.Controls.Add(container); }
protected override void OnInit(EventArgs e) { if (ContentTemplate != null) { ContentTemplate.InstantiateIn(this); } base.OnInit(e); }
protected override void OnInit(EventArgs e) { base.OnInit(e); ScriptManager.RegisterUpdatePanel(this); if (ContentTemplate != null) { ContentTemplate.InstantiateIn(ContentTemplateContainer); } }
private void CreateContents(System.Web.UI.HtmlControls.HtmlTableCell Parent) { if (ContentTemplate != null) { if (ContentTemplateContainer == null) { _Container = new Panel(); ContentTemplate.InstantiateIn(ContentTemplateContainer); } } _Container.CssClass = "content"; Parent.Controls.Clear(); Parent.Controls.Add(ContentTemplateContainer); regions.Add((IAttributeAccessor)ContentTemplateContainer); }
/// <summary> /// Rendering of the wrapper and it's child controls /// </summary> protected override void CreateChildControls() { Controls.Clear(); if (ContentTemplate != null) { componentHolder = new ComponentHolder(this); ContentTemplate.InstantiateIn(componentHolder); //field to validate Controls.Add(componentHolder); foreach (Control control in componentHolder.Controls) { control.EnableViewState = true; } //triger image var imageUrl = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "InputValidationWrapper.Images." + (String.IsNullOrEmpty(this.MessageType) ? "error" : this.MessageType) + ".png"); var imageTextBg = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "InputValidationWrapper.Images.bg.png"); var imageTextBgArrow = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "InputValidationWrapper.Images.bg-arrow.png"); string style = " style='background: url(" + imageUrl + ") no-repeat center center;'"; string textBg = " style='background: url(" + imageTextBg + ");'"; string textBgArrow = " style='background: url(" + imageTextBgArrow + ");'"; Controls.Add(new LiteralControl("<i" + style + ">trigger</i>")); Controls.Add(new LiteralControl("<p" + textBg + "><label " + textBgArrow + " class='bottom_arrow'></label>" + this.Text + "</p>")); ClientScriptManager csm = Page.ClientScript; WebControl Child = ComponentHolder.FindControl(this.ControlToValidateID) as WebControl; if (!(Child is TextBox)) { throw new NotSupportedException("Wrapper can validate only TextBox currently."); } //!!!the validation invoker is there purely to bypass asp's problem with posting back on 'onblur' event when the control is inside of an update panel //Controls.Add(new LiteralControl("<a id=\"" + this.ClientID + "_Invoker\" href=\"javascript:" + @csm.GetPostBackEventReference(this, "RunValidation") + "\">Run</a>")); } else { Controls.Add(new LiteralControl(this.ID)); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); uxMessagePlaceHolder.Controls.Clear(); uxValidationSummaryPlaceHolder.Controls.Clear(); uxValidationDenotePlaceHolder.Controls.Clear(); uxLanguageControlPlaceHolder.Controls.Clear(); uxButtonEventPlaceHolder.Controls.Clear(); uxButtonCommandPlaceHolder.Controls.Clear(); uxButtonEventInnerBoxPlaceHolder.Controls.Clear(); uxTopContentBoxPlaceHolder.Controls.Clear(); uxFilterPlaceHolder.Controls.Clear(); uxSpecialFilterPlaceHolder.Controls.Clear(); uxPageNumberPlaceHolder.Controls.Clear(); uxGridPlaceHolder.Controls.Clear(); uxBottomContentBoxPlaceHolder.Controls.Clear(); uxContentPlaceHolder.Controls.Clear(); // Message. ContentContainer container = new ContentContainer(); if (MessageTemplate != null) { MessageTemplate.InstantiateIn(container); uxMessagePlaceHolder.Controls.Add(container); uxMessagePlaceHolder.Visible = true; } else { uxMessagePlaceHolder.Controls.Add(new LiteralControl("No Message Defined")); uxMessagePlaceHolder.Visible = false; } // Validation Summary container = new ContentContainer(); if (ValidationSummaryTemplate != null) { ValidationSummaryTemplate.InstantiateIn(container); uxValidationSummaryPlaceHolder.Controls.Add(container); uxValidationSummaryPanel.Visible = true; } else { uxValidationSummaryPlaceHolder.Controls.Add(new LiteralControl("No Validation Summary Defined")); uxValidationSummaryPanel.Visible = false; } // Validation Denotes container = new ContentContainer(); if (ValidationDenotesTemplate != null) { ValidationDenotesTemplate.InstantiateIn(container); uxValidationDenotePlaceHolder.Controls.Add(container); uxValidationDenotePanel.Visible = true; } else { uxValidationDenotePlaceHolder.Controls.Add(new LiteralControl("No Validation Denotes Defined")); uxValidationDenotePanel.Visible = false; } // If all message disapear message panel will not show. if (!uxMessagePlaceHolder.Visible & !uxValidationSummaryPanel.Visible) { uxMessagePanel.Visible = false; } else { uxMessagePanel.Visible = true; } container = new ContentContainer(); if (LanguageControlTemplate != null) { LanguageControlTemplate.InstantiateIn(container); uxLanguageControlPlaceHolder.Controls.Add(container); uxLanguageControlPanel.Visible = true; } else { uxLanguageControlPlaceHolder.Controls.Add(new LiteralControl("No Language Control Defined")); uxLanguageControlPanel.Visible = false; } // If don't have any language and message top panel will not show. if (!uxFilterPanel.Visible & !uxLanguageControlPanel.Visible & !uxSpecialFilterPanel.Visible) { uxTopPagePanel.Visible = false; } else { uxTopPagePanel.Visible = true; } if (ButtonEventTemplate == null) { uxButtonEventPanel.Visible = false; } else { container = new ContentContainer(); ButtonEventTemplate.InstantiateIn(container); uxButtonEventPlaceHolder.Controls.Add(container); uxButtonEventPanel.Visible = true; } if (ButtonCommandTemplate == null) { uxButtonCommandPanel.Visible = false; } else { container = new ContentContainer(); ButtonCommandTemplate.InstantiateIn(container); uxButtonCommandPlaceHolder.Controls.Add(container); uxButtonCommandPanel.Visible = true; } if (ButtonEventInnerBoxTemplate == null) { uxButtonEventInnerBoxPanel.Visible = false; } else { container = new ContentContainer(); ButtonEventInnerBoxTemplate.InstantiateIn(container); uxButtonEventInnerBoxPlaceHolder.Controls.Add(container); uxButtonEventInnerBoxPanel.Visible = true; } container = new ContentContainer(); if (TopContentBoxTemplate != null) { TopContentBoxTemplate.InstantiateIn(container); uxTopContentBoxPlaceHolder.Controls.Add(container); uxTopContentBoxPanel.Visible = true; } else { uxTopContentBoxPlaceHolder.Controls.Add(new LiteralControl("No TopContentBox Content Defined")); uxTopContentBoxPlaceHolder.Visible = false; uxTopContentBoxPanel.Visible = false; } container = new ContentContainer(); if (ContentTemplate != null) { ContentTemplate.InstantiateIn(container); uxContentPlaceHolder.Controls.Add(container); uxContentPanel.Visible = true; } else { uxContentPlaceHolder.Controls.Add(new LiteralControl("No Template Defined")); uxContentPanel.Visible = false; } container = new ContentContainer(); if (PlainContentTemplate != null) { PlainContentTemplate.InstantiateIn(container); uxPlainContentPlaceHolder.Controls.Add(container); uxPlainContentPanel.Visible = true; } else { uxPlainContentPlaceHolder.Controls.Add(new LiteralControl("No Template Defined")); uxPlainContentPanel.Visible = false; } if (FilterTemplate == null) { uxFilterPanel.Visible = false; } else { container = new ContentContainer(); FilterTemplate.InstantiateIn(container); uxFilterPlaceHolder.Controls.Add(container); uxFilterPanel.Visible = true; } if (SpecialFilterTemplate == null) { uxSpecialFilterPanel.Visible = false; } else { container = new ContentContainer(); SpecialFilterTemplate.InstantiateIn(container); uxSpecialFilterPlaceHolder.Controls.Add(container); uxSpecialFilterPanel.Visible = true; } if (PageNumberTemplate == null) { uxPageNumberPanel.Visible = false; } else { container = new ContentContainer(); PageNumberTemplate.InstantiateIn(container); uxPageNumberPlaceHolder.Controls.Add(container); uxPageNumberPanel.Visible = true; } if (GridTemplate == null) { uxGridPanel.Visible = false; } else { container = new ContentContainer(); GridTemplate.InstantiateIn(container); uxGridPlaceHolder.Controls.Add(container); uxGridPanel.Visible = true; } if (uxGridPanel.Visible || uxPageNumberPanel.Visible || uxTopContentBoxPlaceHolder.Visible || uxButtonCommandPanel.Visible || uxButtonEventInnerBoxPanel.Visible) { uxTopContentBoxSet.Visible = true; } else { uxTopContentBoxSet.Visible = false; } if (BottomContentBoxTemplate == null) { uxBottomContentBoxPlaceHolder.Visible = false; uxBottomContentBoxPanel.Visible = false; } else { container = new ContentContainer(); BottomContentBoxTemplate.InstantiateIn(container); uxBottomContentBoxPlaceHolder.Controls.Add(container); uxBottomContentBoxPlaceHolder.Visible = true; } if (HeaderMessageTemplate != null) { HeaderMessageTemplate.InstantiateIn(container); uxHeaderMeassagePlaceHolder.Controls.Add(container); uxHeaderMeassagePanel.Visible = true; } else { uxHeaderMeassagePlaceHolder.Controls.Add(new LiteralControl("No Template Defined")); uxHeaderMeassagePanel.Visible = false; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); uxMessagePlaceHolder.Controls.Clear(); uxValidationSummaryPlaceHolder.Controls.Clear(); uxValidationDenotePlaceHolder.Controls.Clear(); uxLanguageControlPlaceHolder.Controls.Clear(); uxButtonEventPlaceHolder.Controls.Clear(); uxTopContentBoxPlaceHolder.Controls.Clear(); uxContentPlaceHolder.Controls.Clear(); // Message. ContentContainer container = new ContentContainer(); if (MessageTemplate != null) { MessageTemplate.InstantiateIn(container); uxMessagePlaceHolder.Controls.Add(container); } else { uxMessagePlaceHolder.Controls.Add(new LiteralControl("No Message Defined")); uxMessagePlaceHolder.Visible = false; } // Validation Summary container = new ContentContainer(); if (ValidationSummaryTemplate != null) { ValidationSummaryTemplate.InstantiateIn(container); uxValidationSummaryPlaceHolder.Controls.Add(container); } else { uxValidationSummaryPlaceHolder.Controls.Add(new LiteralControl("No Validation Summary Defined")); uxValidationSummaryPanel.Visible = false; } // Validation Denotes container = new ContentContainer(); if (ValidationDenotesTemplate != null) { ValidationDenotesTemplate.InstantiateIn(container); uxValidationDenotePlaceHolder.Controls.Add(container); } else { uxValidationDenotePlaceHolder.Controls.Add(new LiteralControl("No Validation Denotes Defined")); uxValidationDenotePanel.Visible = false; } container = new ContentContainer(); if (LanguageControlTemplate != null) { LanguageControlTemplate.InstantiateIn(container); uxLanguageControlPlaceHolder.Controls.Add(container); } else { uxLanguageControlPlaceHolder.Controls.Add(new LiteralControl("No Language Control Defined")); uxLanguageControlPanel.Visible = false; } container = new ContentContainer(); if (ButtonEventTemplate != null) { ButtonEventTemplate.InstantiateIn(container); uxButtonEventPlaceHolder.Controls.Add(container); } else { uxButtonEventPlaceHolder.Controls.Add(container); uxButtonEventPanel.Visible = false; } container = new ContentContainer(); if (TopContentBoxTemplate != null) { TopContentBoxTemplate.InstantiateIn(container); uxTopContentBoxPlaceHolder.Controls.Add(container); } else { uxTopContentBoxPlaceHolder.Controls.Add(new LiteralControl("No TopContentBox Content Defined")); uxTopContentBoxSet.Visible = false; } container = new ContentContainer(); if (ContentTemplate != null) { ContentTemplate.InstantiateIn(container); uxContentPlaceHolder.Controls.Add(container); } else { uxContentPlaceHolder.Controls.Add(new LiteralControl("No Template Defined")); uxContentPanel.Visible = false; } container = new ContentContainer(); if (PlainContentTemplate != null) { PlainContentTemplate.InstantiateIn(container); uxPlainContentPlaceHolder.Controls.Add(container); uxPlainContentPanel.Visible = true; } else { uxPlainContentPlaceHolder.Controls.Add(new LiteralControl("No Template Defined")); uxPlainContentPanel.Visible = false; } }