/// <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(); _hfExpanded = new HiddenFieldWithClass(); Controls.Add( _hfExpanded ); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.CssClass = "filter-expanded"; _hfExpanded.Value = "False"; _hfFormGuid = new HiddenField(); Controls.Add( _hfFormGuid ); _hfFormGuid.ID = this.ID + "_hfFormGuid"; _hfFormId = new HiddenField(); Controls.Add( _hfFormId ); _hfFormId.ID = this.ID + "_hfFormId"; _lblFormName = new Label(); Controls.Add( _lblFormName ); _lblFormName.ClientIDMode = ClientIDMode.Static; _lblFormName.ID = this.ID + "_lblFormName"; _lbDeleteForm = new LinkButton(); Controls.Add( _lbDeleteForm ); _lbDeleteForm.CausesValidation = false; _lbDeleteForm.ID = this.ID + "_lbDeleteForm"; _lbDeleteForm.CssClass = "btn btn-xs btn-danger js-activity-delete"; _lbDeleteForm.Click += lbDeleteForm_Click; _lbDeleteForm.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } ); _tbFormName = new RockTextBox(); Controls.Add( _tbFormName ); _tbFormName.ID = this.ID + "_tbFormName"; _tbFormName.Label = "Form Name"; _tbFormName.Required = true; _tbFormName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblFormName.ID ); _gFields = new Grid(); Controls.Add( _gFields ); _gFields.ID = this.ID + "_gFields"; _gFields.AllowPaging = false; _gFields.DisplayType = GridDisplayType.Light; _gFields.RowItemText = "Field"; _gFields.AddCssClass( "field-grid" ); _gFields.DataKeyNames = new string[] { "Guid" }; _gFields.Actions.ShowAdd = true; _gFields.Actions.AddClick += gFields_Add; _gFields.GridRebind += gFields_Rebind; _gFields.GridReorder += gFields_Reorder; var reorderField = new ReorderField(); _gFields.Columns.Add( reorderField ); var nameField = new BoundField(); nameField.DataField = "Name"; nameField.HeaderText = "Field"; _gFields.Columns.Add( nameField ); var sourceField = new EnumField(); sourceField.DataField = "FieldSource"; sourceField.HeaderText = "Source"; _gFields.Columns.Add( sourceField ); var typeField = new FieldTypeField(); typeField.DataField = "FieldType"; typeField.HeaderText = "Type"; _gFields.Columns.Add( typeField ); var isInternalField = new BoolField(); isInternalField.DataField = "IsInternal"; isInternalField.HeaderText = "Internal"; _gFields.Columns.Add( isInternalField ); var isSharedValueField = new BoolField(); isSharedValueField.DataField = "IsSharedValue"; isSharedValueField.HeaderText = "Common"; _gFields.Columns.Add( isSharedValueField ); var showCurrentValueField = new BoolField(); showCurrentValueField.DataField = "ShowCurrentValue"; showCurrentValueField.HeaderText = "Use Current Value"; _gFields.Columns.Add( showCurrentValueField ); var isRequiredField = new BoolField(); isRequiredField.DataField = "IsRequired"; isRequiredField.HeaderText = "Required"; _gFields.Columns.Add( isRequiredField ); var isGridField = new BoolField(); isGridField.DataField = "IsGridField"; isGridField.HeaderText = "Show on Grid"; _gFields.Columns.Add( isGridField ); var editField = new EditField(); editField.Click += gFields_Edit; _gFields.Columns.Add( editField ); var delField = new DeleteField(); delField.Click += gFields_Delete; _gFields.Columns.Add( delField ); }
/// <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(); _hfExpanded = new HiddenFieldWithClass(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.CssClass = "filter-expanded"; _hfExpanded.Value = "False"; _hfFormGuid = new HiddenField(); Controls.Add(_hfFormGuid); _hfFormGuid.ID = this.ID + "_hfFormGuid"; _hfFormId = new HiddenField(); Controls.Add(_hfFormId); _hfFormId.ID = this.ID + "_hfFormId"; _lblFormName = new Label(); Controls.Add(_lblFormName); _lblFormName.ClientIDMode = ClientIDMode.Static; _lblFormName.ID = this.ID + "_lblFormName"; _lbDeleteForm = new LinkButton(); Controls.Add(_lbDeleteForm); _lbDeleteForm.CausesValidation = false; _lbDeleteForm.ID = this.ID + "_lbDeleteForm"; _lbDeleteForm.CssClass = "btn btn-xs btn-danger js-activity-delete"; _lbDeleteForm.Click += lbDeleteForm_Click; _lbDeleteForm.Controls.Add(new LiteralControl { Text = "<i class='fa fa-times'></i>" }); _tbFormName = new RockTextBox(); Controls.Add(_tbFormName); _tbFormName.ID = this.ID + "_tbFormName"; _tbFormName.Label = "Form Name"; _tbFormName.Required = true; _tbFormName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblFormName.ID); _gFields = new Grid(); Controls.Add(_gFields); _gFields.ID = this.ID + "_gFields"; _gFields.AllowPaging = false; _gFields.DisplayType = GridDisplayType.Light; _gFields.RowItemText = "Field"; _gFields.AddCssClass("field-grid"); _gFields.DataKeyNames = new string[] { "Guid" }; _gFields.Actions.ShowAdd = true; _gFields.Actions.AddClick += gFields_Add; _gFields.GridRebind += gFields_Rebind; _gFields.GridReorder += gFields_Reorder; var reorderField = new ReorderField(); _gFields.Columns.Add(reorderField); var nameField = new BoundField(); nameField.DataField = "Name"; nameField.HeaderText = "Field"; _gFields.Columns.Add(nameField); var sourceField = new EnumField(); sourceField.DataField = "FieldSource"; sourceField.HeaderText = "Source"; _gFields.Columns.Add(sourceField); var typeField = new FieldTypeField(); typeField.DataField = "FieldType"; typeField.HeaderText = "Type"; _gFields.Columns.Add(typeField); var isInternalField = new BoolField(); isInternalField.DataField = "IsInternal"; isInternalField.HeaderText = "Internal"; _gFields.Columns.Add(isInternalField); var isSharedValueField = new BoolField(); isSharedValueField.DataField = "IsSharedValue"; isSharedValueField.HeaderText = "Common"; _gFields.Columns.Add(isSharedValueField); var showCurrentValueField = new BoolField(); showCurrentValueField.DataField = "ShowCurrentValue"; showCurrentValueField.HeaderText = "Use Current Value"; _gFields.Columns.Add(showCurrentValueField); var isRequiredField = new BoolField(); isRequiredField.DataField = "IsRequired"; isRequiredField.HeaderText = "Required"; _gFields.Columns.Add(isRequiredField); var isGridField = new BoolField(); isGridField.DataField = "IsGridField"; isGridField.HeaderText = "Show on Grid"; _gFields.Columns.Add(isGridField); var showOnWaitListField = new BoolField(); showOnWaitListField.DataField = "ShowOnWaitlist"; showOnWaitListField.HeaderText = "Show on Wait List"; _gFields.Columns.Add(showOnWaitListField); var editField = new EditField(); editField.Click += gFields_Edit; _gFields.Columns.Add(editField); var delField = new DeleteField(); delField.Click += gFields_Delete; _gFields.Columns.Add(delField); }