Inheritance: System.Web.UI.WebControls.RadioButton
Ejemplo n.º 1
0
        /// <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)
                {
                    SelectionMode     = selectField.SelectionMode;
                    DataVisibleField  = selectField.DataVisibleField;
                    DataSelectedField = selectField.DataSelectedField;
                    DataTextField     = selectField.DataTextField;
                    ColumnIndex       = selectField.ColumnIndex;

                    CheckBox cb = null;

                    if (SelectionMode == SelectionMode.Multiple)
                    {
                        cb = new CheckBox();
                    }
                    else
                    {
                        cb = new RockRadioButton();
                    }

                    cb.ID           = "cbSelect_" + ColumnIndex.ToString();
                    cb.DataBinding += cb_DataBinding;
                    cell.ToolTip    = selectField.Tooltip;
                    cell.Controls.Add(cb);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the property selection.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="personId">The person identifier.</param>
        /// <returns></returns>
        public static PropertySelection GetPropertySelection(GridViewRow row, int personId)
        {
            Panel selectionControlContainer = row.FindControl($"selectionControlContainer_{personId}") as Panel;

            RockCheckBox    selectionControlCheckbox    = selectionControlContainer.FindControl($"selectionControlCheckbox_{personId}") as RockCheckBox;
            RockRadioButton selectionControlRadioButton = selectionControlContainer.FindControl($"selectionControlRadioButton_{personId}") as RockRadioButton;

            var result = new PropertySelection
            {
                PropertyKey = (row.NamingContainer as Grid).DataKeys[row.RowIndex].Value as string
            };

            if (selectionControlCheckbox.Visible)
            {
                result.Selected = selectionControlCheckbox.Checked;
            }
            else if (selectionControlRadioButton.Visible)
            {
                result.Selected = selectionControlRadioButton.Checked;
            }
            else
            {
                result.IsSectionHeader = true;
                result.Selected        = false;
            }

            return(result);
        }
Ejemplo n.º 3
0
        /// <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();

            _hfTemplateKey          = new HiddenFieldWithClass();
            _hfTemplateKey.ID       = this.ID + "_hfValue";
            _hfTemplateKey.CssClass = "js-template-id";
            this.Controls.Add(_hfTemplateKey);

            _pnlStandard          = new Panel();
            _pnlStandard.ID       = this.ID + "_pnlOption";
            _pnlStandard.CssClass = "js-template-option-panel";
            this.Controls.Add(_pnlStandard);

            _btnCustomize                  = new LinkButton();
            _btnCustomize.CssClass         = "btn btn-xs btn-link";
            _btnCustomize.ID               = string.Format("{0}_btnCustomize", this.ID);
            _btnCustomize.Text             = "Customize";
            _btnCustomize.CausesValidation = false;
            _btnCustomize.Click           += btnCustomize_Click;
            this.Controls.Add(_btnCustomize);

            _pnlCustom          = new Panel();
            _pnlCustom.ID       = this.ID + "pnlCustom";
            _pnlCustom.CssClass = "js-template-custom-panel";
            this.Controls.Add(_pnlCustom);

            _rbbCustom         = new RockRadioButton();
            _rbbCustom.Checked = true;
            _rbbCustom.Text    = "<b>Custom</b>";
            _pnlCustom.Controls.Add(_rbbCustom);

            _actionDiv = new HtmlGenericControl("div");
            _pnlCustom.Controls.Add(_actionDiv);
            _actionDiv.Attributes["class"] = "actions clearfix";

            _btnStandard                  = new LinkButton();
            _btnStandard.CssClass         = "btn btn-xs btn-link pull-right";
            _btnStandard.ID               = string.Format("{0}_btnStandard", this.ID);
            _btnStandard.Text             = "Use Standard Templates";
            _btnStandard.CausesValidation = false;
            _btnStandard.Click           += btnStandard_Click;
            _actionDiv.Controls.Add(_btnStandard);

            _ceLavaTemplate          = new CodeEditor();
            _ceLavaTemplate.ID       = this.ID + "_ceLavaTemplate";
            _ceLavaTemplate.CssClass = "js-template-lava-field";
            _pnlCustom.Controls.Add(_ceLavaTemplate);

            RockControlHelper.CreateChildControls(this, Controls);
        }
Ejemplo n.º 4
0
            /// <summary>
            /// Handles the Load event of the cell control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void cell_Load(object sender, EventArgs e)
            {
                DataControlFieldCell cell = sender as DataControlFieldCell;
                var row = cell.DataItemContainer as GridViewRow;

                if (row.Page.IsPostBack)
                {
                    Panel           selectionControlContainer   = row.FindControl($"selectionControlContainer_{MergePersonField.PersonId}") as Panel;
                    RockCheckBox    selectionControlCheckbox    = selectionControlContainer.FindControl($"selectionControlCheckbox_{MergePersonField.PersonId}") as RockCheckBox;
                    RockRadioButton selectionControlRadioButton = selectionControlContainer.FindControl($"selectionControlRadioButton_{MergePersonField.PersonId}") as RockRadioButton;
                }
            }
Ejemplo n.º 5
0
            /// <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)
            {
                DataControlFieldCell cell = container as DataControlFieldCell;

                this.MergePersonField = cell.ContainingField as MergePersonField;

                Panel selectionControlContainer = new Panel {
                    ID = $"selectionControlContainer_{MergePersonField.PersonId}", CssClass = "js-selection-control-container selection-control-container",
                };

                cell.Controls.Add(selectionControlContainer);

                RockCheckBox selectionControlCheckbox = new RockCheckBox
                {
                    ID       = $"selectionControlCheckbox_{MergePersonField.PersonId}",
                    CssClass = "js-selection-control selection-control"
                };

                selectionControlCheckbox.Attributes["data-person-id"] = MergePersonField.PersonId.ToString();
                selectionControlContainer.Controls.Add(selectionControlCheckbox);

                RockRadioButton selectionControlRadioButton = new RockRadioButton
                {
                    ID       = $"selectionControlRadioButton_{MergePersonField.PersonId}",
                    CssClass = "js-selection-control selection-control"
                };

                selectionControlRadioButton.Attributes["data-person-id"] = MergePersonField.PersonId.ToString();
                selectionControlContainer.Controls.Add(selectionControlRadioButton);

                Literal contentHtmlLiteral = new Literal {
                    ID = $"contentHtmlLiteral_{MergePersonField.PersonId}"
                };

                cell.Controls.Add(contentHtmlLiteral);

                cell.CssClass = "js-merge-field-cell merge-field-cell";

                cell.DataBinding += cell_DataBinding;
                cell.Load        += cell_Load;
            }
Ejemplo n.º 6
0
            /// <summary>
            /// Handles the DataBinding event of the cell control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void cell_DataBinding(object sender, EventArgs e)
            {
                DataControlFieldCell cell = sender as DataControlFieldCell;
                var row = cell.DataItemContainer as GridViewRow;

                Literal         contentHtmlLiteral          = cell.FindControl($"contentHtmlLiteral_{MergePersonField.PersonId}") as Literal;
                Panel           selectionControlContainer   = cell.FindControl($"selectionControlContainer_{MergePersonField.PersonId}") as Panel;
                RockCheckBox    selectionControlCheckbox    = selectionControlContainer.FindControl($"selectionControlCheckbox_{MergePersonField.PersonId}") as RockCheckBox;
                RockRadioButton selectionControlRadioButton = selectionControlContainer.FindControl($"selectionControlRadioButton_{MergePersonField.PersonId}") as RockRadioButton;

                MergePersonFieldRowEventArgs mergePersonFieldRowEventArgs = new MergePersonFieldRowEventArgs(row, MergePersonField);

                MergePersonField.HandleOnDataBound(sender, mergePersonFieldRowEventArgs);

                if (mergePersonFieldRowEventArgs.ContentDisplayType == ContentDisplayType.ContentWrapper)
                {
                    contentHtmlLiteral.Visible       = true;
                    contentHtmlLiteral.Text          = $"<div class='merge-property-value'>{mergePersonFieldRowEventArgs.ContentHTML}</div>";
                    selectionControlCheckbox.Text    = null;
                    selectionControlRadioButton.Text = null;
                }
                else
                {
                    contentHtmlLiteral.Visible       = false;
                    selectionControlCheckbox.Text    = mergePersonFieldRowEventArgs.ContentHTML;
                    selectionControlRadioButton.Text = mergePersonFieldRowEventArgs.ContentHTML;
                }

                selectionControlCheckbox.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.Checkbox;
                selectionControlCheckbox.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.RadioButton;
                selectionControlRadioButton.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.GroupName = $"selectionControlRadioButtonGroup_{row.RowIndex}";
            }
Ejemplo n.º 7
0
        /// <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();

            // Mode Selection Panel and Controls
            _pnlModeSelection = new Panel {
                ID = "pnlModeSelection"
            };
            _pnlModeSelection.CssClass      = "picker-mode-options";
            _pnlModeSelection.ViewStateMode = ViewStateMode.Enabled;

            _hfCurrentPickerMode    = new HiddenField();
            _hfCurrentPickerMode.ID = this.ID + "_hfCurrentPickerMode";
            this.Controls.Add(_hfCurrentPickerMode);

            _radNamed = new RockRadioButton {
                ID = "radNamed"
            };
            _radNamed.Text      = "Location";
            _radNamed.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add(_radNamed);

            _radAddress = new RockRadioButton {
                ID = "radAddress"
            };
            _radAddress.Text      = "Address";
            _radAddress.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add(_radAddress);

            _radPoint = new RockRadioButton {
                ID = "radPoint"
            };
            _radPoint.Text      = "Point";
            _radPoint.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add(_radPoint);

            _radPolygon = new RockRadioButton {
                ID = "radPolygon"
            };
            _radPolygon.Text      = "Geo-fence";
            _radPolygon.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add(_radPolygon);

            _pickersPanel = new Panel {
                ID = "pickersPanel"
            };
            _pickersPanel.ViewStateMode = ViewStateMode.Disabled;
            this.Controls.Add(_pickersPanel);

            _namedPicker    = new LocationItemPicker();
            _namedPicker.ID = this.ID + "_namedPicker";

            _addressPicker    = new LocationAddressPicker();
            _addressPicker.ID = this.ID + "_addressPicker";
            _addressPicker.SelectGeography += _addressPicker_SelectGeography;

            _pointPicker                  = new GeoPicker();
            _pointPicker.ID               = this.ID + "_pointPicker";
            _pointPicker.DrawingMode      = GeoPicker.ManagerDrawingMode.Point;
            _pointPicker.SelectGeography += _pointPicker_SelectGeography;

            _polygonPicker                  = new GeoPicker();
            _polygonPicker.ID               = this.ID + "_polygonPicker";
            _polygonPicker.DrawingMode      = GeoPicker.ManagerDrawingMode.Polygon;
            _polygonPicker.SelectGeography += _polygonPicker_SelectGeography;

            _namedPicker.ModePanel   = _pnlModeSelection;
            _pointPicker.ModePanel   = _pnlModeSelection;
            _polygonPicker.ModePanel = _pnlModeSelection;
            _addressPicker.ModePanel = _pnlModeSelection;

            _pickersPanel.Controls.Add(_namedPicker);
            _pickersPanel.Controls.Add(_addressPicker);
            _pickersPanel.Controls.Add(_pointPicker);
            _pickersPanel.Controls.Add(_polygonPicker);
        }
Ejemplo n.º 8
0
        /// <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 )
                {
                    SelectionMode = selectField.SelectionMode;
                    DataVisibleField = selectField.DataVisibleField;
                    DataSelectedField = selectField.DataSelectedField;
                    DataTextField = selectField.DataTextField;
                    ColumnIndex = selectField.ColumnIndex;

                    CheckBox cb = null;

                    if ( SelectionMode == SelectionMode.Multiple )
                    {
                        cb = new CheckBox();
                    }
                    else
                    {
                        cb = new RockRadioButton();
                    }

                    cb.ID = "cbSelect_" + ColumnIndex.ToString();
                    cb.DataBinding += cb_DataBinding;
                    cell.Controls.Add( cb );
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduleBuilder"/> class.
        /// </summary>
        public ScheduleBuilderPopupContents()
        {
            // common
            _dpStartDateTime = new DateTimePicker();

            _tbDurationHours = new NumberBox();
            _tbDurationMinutes = new NumberBox();

            _radOneTime = new RockRadioButton();
            _radRecurring = new RockRadioButton();

            _radSpecificDates = new RockRadioButton();
            _radDaily = new RockRadioButton();
            _radWeekly = new RockRadioButton();
            _radMonthly = new RockRadioButton();

            // specific date
            _hfSpecificDateListValues = new HiddenFieldWithClass();
            _hfSpecificDateListValues.CssClass = "js-specific-datelist-values";

            _dpSpecificDate = new DatePicker();

            // daily
            _radDailyEveryXDays = new RockRadioButton();
            _tbDailyEveryXDays = new NumberBox();
            _radDailyEveryWeekday = new RockRadioButton();
            _radDailyEveryWeekendDay = new RockRadioButton();

            // weekly
            _tbWeeklyEveryX = new NumberBox();
            _cbWeeklySunday = new RockCheckBox();
            _cbWeeklyMonday = new RockCheckBox();
            _cbWeeklyTuesday = new RockCheckBox();
            _cbWeeklyWednesday = new RockCheckBox();
            _cbWeeklyThursday = new RockCheckBox();
            _cbWeeklyFriday = new RockCheckBox();
            _cbWeeklySaturday = new RockCheckBox();

            // monthly
            _radMonthlyDayX = new RockRadioButton();
            _tbMonthlyDayX = new NumberBox();
            _tbMonthlyXMonths = new NumberBox();
            _radMonthlyNth = new RockRadioButton();
            _ddlMonthlyNth = new RockDropDownList();
            _ddlMonthlyDayName = new RockDropDownList();

            // end date
            _radEndByNone = new RockRadioButton();
            _radEndByDate = new RockRadioButton();
            _dpEndBy = new DatePicker();
            _radEndByOccurrenceCount = new RockRadioButton();
            _tbEndByOccurrenceCount = new NumberBox();

            // exclusions
            _hfExclusionDateRangeListValues = new HiddenFieldWithClass();
            _hfExclusionDateRangeListValues.CssClass = "js-exclusion-daterange-list-values";
            _dpExclusionDateRange = new DateRangePicker();
        }
Ejemplo n.º 10
0
        /// <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();

            // Mode Selection Panel and Controls
            _pnlModeSelection = new Panel { ID = "pnlModeSelection" };
            _pnlModeSelection.CssClass = "picker-mode-options";
            _pnlModeSelection.ViewStateMode = ViewStateMode.Enabled;

            _hfCurrentPickerMode = new HiddenField();
            _hfCurrentPickerMode.ID = this.ID + "_hfCurrentPickerMode";
            this.Controls.Add( _hfCurrentPickerMode );

            _radNamed = new RockRadioButton { ID = "radNamed" };
            _radNamed.Text = "Location";
            _radNamed.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add( _radNamed );

            _radAddress = new RockRadioButton { ID = "radAddress" };
            _radAddress.Text = "Address";
            _radAddress.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add( _radAddress );

            _radPoint = new RockRadioButton { ID = "radPoint" };
            _radPoint.Text = "Point";
            _radPoint.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add( _radPoint );

            _radPolygon = new RockRadioButton { ID = "radPolygon" };
            _radPolygon.Text = "Geo-fence";
            _radPolygon.GroupName = "radiogroup-location-mode_" + this.ClientID;
            _pnlModeSelection.Controls.Add( _radPolygon );

            _pickersPanel = new Panel { ID = "pickersPanel" };
            _pickersPanel.ViewStateMode = ViewStateMode.Disabled;
            this.Controls.Add( _pickersPanel );

            _namedPicker = new LocationItemPicker();
            _namedPicker.ID = this.ID + "_namedPicker";

            _addressPicker = new LocationAddressPicker();
            _addressPicker.ID = this.ID + "_addressPicker";

            _pointPicker = new GeoPicker();
            _pointPicker.ID = this.ID + "_pointPicker";
            _pointPicker.DrawingMode = GeoPicker.ManagerDrawingMode.Point;
            _pointPicker.SelectGeography += _pointPicker_SelectGeography;

            _polygonPicker = new GeoPicker();
            _polygonPicker.ID = this.ID + "_polygonPicker";
            _polygonPicker.DrawingMode = GeoPicker.ManagerDrawingMode.Polygon;
            _polygonPicker.SelectGeography += _polygonPicker_SelectGeography;

            _namedPicker.ModePanel = _pnlModeSelection;
            _pointPicker.ModePanel = _pnlModeSelection;
            _polygonPicker.ModePanel = _pnlModeSelection;
            _addressPicker.ModePanel = _pnlModeSelection;

            _pickersPanel.Controls.Add( _namedPicker );
            _pickersPanel.Controls.Add( _addressPicker );
            _pickersPanel.Controls.Add( _pointPicker );
            _pickersPanel.Controls.Add( _polygonPicker );
        }