/// <summary> /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control" /> object that child controls and templates belong to. These child controls are in turn defined within an inline template. /// </summary> /// <param name="container">The <see cref="T:System.Web.UI.Control" /> object to contain the instances of controls from the inline template.</param> public void InstantiateIn( Control container ) { var cell = container as DataControlFieldCell; if ( cell != null ) { var selectField = cell.ContainingField as SelectField; if ( selectField != null ) { Literal l = new Literal(); l.Text = selectField.HeaderText; cell.Controls.Add( l ); if ( selectField.SelectionMode == SelectionMode.Multiple && selectField.ShowHeader ) { string colIndex = selectField.ColumnIndex.ToString(); CheckBox cb = new CheckBox(); cb.ID = "cbSelectHead_" + colIndex; cb.AddCssClass( "select-all" ); cell.AddCssClass( "grid-select-field" ); cell.Controls.Add( cb ); } } } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfOrder = new HiddenField(); _hfOrder.ID = this.ID + "_hfOrder"; Controls.Add( _hfOrder ); _cbVisible = new CheckBox(); _cbVisible.ID = this.ID + "_cbVisible"; Controls.Add( _cbVisible ); _cbEditable = new CheckBox(); _cbEditable.ID = this.ID + "_cbEditable"; Controls.Add( _cbEditable ); _cbRequired = new CheckBox(); _cbRequired.ID = this.ID + "_cbRequired"; Controls.Add( _cbRequired ); _cbHideLabel = new CheckBox(); _cbHideLabel.ID = this.ID + "_cbHideLabel"; Controls.Add( _cbHideLabel ); _cbPreHtml = new CheckBox(); _cbPreHtml.ID = this.ID + "_cbPreHtml"; _cbPreHtml.AddCssClass( "js-form-attribute-show-pre-html" ); Controls.Add( _cbPreHtml ); _cbPostHtml = new CheckBox(); _cbPostHtml.ID = this.ID + "_cbPostHtml"; _cbPostHtml.AddCssClass( "js-form-attribute-show-post-html" ); Controls.Add( _cbPostHtml ); _tbPreHtml = new RockTextBox(); _tbPreHtml.ID = this.ID + "_tbPreHtml"; _tbPreHtml.TextMode = TextBoxMode.MultiLine; _tbPreHtml.Rows = 3; _tbPreHtml.ValidateRequestMode = System.Web.UI.ValidateRequestMode.Disabled; Controls.Add( _tbPreHtml ); _tbPostHtml = new RockTextBox(); _tbPostHtml.ID = this.ID + "_tbPostHtml"; _tbPostHtml.TextMode = TextBoxMode.MultiLine; _tbPostHtml.Rows = 3; _tbPostHtml.ValidateRequestMode = System.Web.UI.ValidateRequestMode.Disabled; Controls.Add( _tbPostHtml ); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); _cbCurrent = new CheckBox(); _cbCurrent.ID = this.ID + "_cbCurrent"; _cbCurrent.AddCssClass( "js-current-date-checkbox" ); _cbCurrent.Text = "Current Date"; this.Controls.Add( _cbCurrent ); _nbDayOffset = new RockTextBox(); _nbDayOffset.ID = this.ID + "_nbDayOffset"; _nbDayOffset.Help = "Enter the number of days after the current date to use as the date. Use a negative number to specify days before."; _nbDayOffset.AddCssClass( "input-width-md js-current-date-offset" ); _nbDayOffset.Label = "+- Days"; this.Controls.Add( _nbDayOffset ); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); RockControlHelper.CreateChildControls( this, Controls ); _date = new TextBox(); _date.ID = "tbDate"; _date.AddCssClass( "form-control js-datetime-date" ); Controls.Add( _date ); _time = new TextBox(); _time.ID = "tbTime"; _time.AddCssClass( "form-control js-datetime-time"); Controls.Add( _time ); _cbCurrent = new CheckBox(); _cbCurrent.ID = "cbCurrent"; _cbCurrent.AddCssClass( "js-current-datetime-checkbox" ); _cbCurrent.Text = "Current Time"; this.Controls.Add( _cbCurrent ); _nbTimeOffset = new RockTextBox(); _nbTimeOffset.ID = "nbTimeOffset"; _nbTimeOffset.Help = "Enter the number of minutes after the current time to use as the date. Use a negative number to specify minutes before."; _nbTimeOffset.AddCssClass( "input-width-md js-current-datetime-offset" ); _nbTimeOffset.Label = "+- Minutes"; this.Controls.Add( _nbTimeOffset ); RequiredFieldValidator.ControlToValidate = _date.ID; }