Exemple #1
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();
            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;
        }