Example #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();

            Panel pnlRow = new Panel
            {
                ID       = "pnlRow",
                CssClass = "row"
            };

            this.Controls.Add(pnlRow);

            Panel pnlCol1 = new Panel
            {
                ID       = "pnlCol1",
                CssClass = "col-sm-4"
            };

            pnlRow.Controls.Add(pnlCol1);
            _dvpPersonTitle = new DefinedValuePicker
            {
                ID              = "_dvpPersonTitle",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_TITLE.AsGuid()),
                Label           = "Title",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            pnlCol1.Controls.Add(_dvpPersonTitle);

            _tbPersonFirstName = new RockTextBox
            {
                ID               = "tbPersonFirstName",
                Label            = "First Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            pnlCol1.Controls.Add(_tbPersonFirstName);

            _tbPersonLastName = new RockTextBox
            {
                ID               = "tbPersonLastName",
                Label            = "Last Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            pnlCol1.Controls.Add(_tbPersonLastName);

            _dvpPersonSuffix = new DefinedValuePicker
            {
                ID              = "dvpPersonSuffix",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_SUFFIX.AsGuid()),
                Label           = "Suffix",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            pnlCol1.Controls.Add(_dvpPersonSuffix);

            Panel pnlCol2 = new Panel
            {
                ID       = "pnlCol2",
                CssClass = "col-sm-4"
            };

            pnlRow.Controls.Add(pnlCol2);

            _dvpPersonConnectionStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonConnectionStatus",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS.AsGuid()),
                Label           = "Connection Status",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            pnlCol2.Controls.Add(_dvpPersonConnectionStatus);

            _rblPersonRole = new RockRadioButtonList
            {
                ID              = "rblPersonRole",
                Label           = "Role",
                RepeatDirection = RepeatDirection.Horizontal,
                DataTextField   = "Name",
                DataValueField  = "Id",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            pnlCol2.Controls.Add(_rblPersonRole);

            _rblPersonGender = new RockRadioButtonList
            {
                ID              = "rblPersonGender",
                Label           = "Gender",
                RepeatDirection = RepeatDirection.Horizontal,
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            pnlCol2.Controls.Add(_rblPersonGender);

            Panel pnlCol3 = new Panel {
                ID = "pnlCol3", CssClass = "col-sm-4"
            };

            pnlRow.Controls.Add(pnlCol3);

            _dpPersonBirthDate = new DatePicker
            {
                ID    = "dpPersonBirthDate",
                Label = "Birthdate",
                AllowFutureDateSelection = false,
                ForceParse      = false,
                ValidationGroup = ValidationGroup
            };

            pnlCol3.Controls.Add(_dpPersonBirthDate);

            _ddlGradePicker = new GradePicker
            {
                ID                    = "ddlGradePicker",
                Label                 = "Grade",
                UseAbbreviation       = true,
                UseGradeOffsetAsValue = true,
                ValidationGroup       = ValidationGroup
            };

            pnlCol3.Controls.Add(_ddlGradePicker);

            _dvpPersonMaritalStatus = new DefinedValuePicker
            {
                ID              = "_vpPersonMaritalStatus",
                Label           = "Marital Status",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid()),
                ValidationGroup = ValidationGroup
            };

            pnlCol3.Controls.Add(_dvpPersonMaritalStatus);

            _ebPersonEmail = new EmailBox
            {
                ID              = "dbPersonEmail",
                Label           = "Email",
                ValidationGroup = ValidationGroup
            };

            pnlCol3.Controls.Add(_ebPersonEmail);

            var groupType = GroupTypeCache.GetFamilyGroupType();

            _rblPersonRole.DataSource = groupType.Roles.OrderBy(r => r.Order).ToList();
            _rblPersonRole.DataBind();

            _rblPersonGender.Items.Clear();
            _rblPersonGender.Items.Add(new ListItem(Gender.Male.ConvertToString(), Gender.Male.ConvertToInt().ToString()));
            _rblPersonGender.Items.Add(new ListItem(Gender.Female.ConvertToString(), Gender.Female.ConvertToInt().ToString()));
            _rblPersonGender.Items.Add(new ListItem(Gender.Unknown.ConvertToString(), Gender.Unknown.ConvertToInt().ToString()));
        }
Example #2
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();

            _rblRole.ID             = "_rblRole";
            _dvpTitle.ID            = "_ddlTitle";
            _tbFirstName.ID         = "_tbFirstName";
            _tbNickName.ID          = "_tbNickName";
            _tbMiddleName.ID        = "_tbMiddleName";
            _tbLastName.ID          = "_tbLastName";
            _dvpSuffix.ID           = "_ddlSuffix";
            _dvpConnectionStatus.ID = "_ddlConnectionStatus";
            _rblGender.ID           = "_rblGender";
            _dpBirthdate.ID         = "_dtBirthdate";
            _ddlGradePicker.ID      = "_ddlGrade";
            _lbDelete.ID            = "_lbDelete";

            Controls.Add(_rblRole);
            Controls.Add(_dvpTitle);
            Controls.Add(_tbFirstName);
            Controls.Add(_tbNickName);
            Controls.Add(_tbMiddleName);
            Controls.Add(_tbLastName);
            Controls.Add(_dvpSuffix);
            Controls.Add(_dvpConnectionStatus);
            Controls.Add(_rblGender);
            Controls.Add(_dpBirthdate);
            Controls.Add(_ddlGradePicker);
            Controls.Add(_lbDelete);

            _rblRole.RepeatDirection       = RepeatDirection.Vertical;
            _rblRole.AutoPostBack          = true;
            _rblRole.SelectedIndexChanged += rblRole_SelectedIndexChanged;
            _rblRole.Required              = true;
            _rblRole.RequiredErrorMessage  = "Role is required for all members";
            _rblRole.DataTextField         = "Name";
            _rblRole.DataValueField        = "Id";
            _rblRole.DataSource            = GroupRoles;
            _rblRole.DataBind();

            _dvpTitle.CssClass      = "form-control";
            _dvpTitle.DefinedTypeId = DefinedTypeCache.Get(new Guid(Rock.SystemGuid.DefinedType.PERSON_TITLE)).Id;

            _tbFirstName.CssClass             = "form-control";
            _tbFirstName.Placeholder          = "First Name";
            _tbFirstName.Required             = true;
            _tbFirstName.RequiredErrorMessage = "First Name is required for all group members";

            _tbNickName.CssClass    = "form-control";
            _tbNickName.Placeholder = "Nick Name";

            _tbMiddleName.CssClass    = "form-control";
            _tbMiddleName.Placeholder = "Middle Name";
            _tbMiddleName.Required    = false;

            _tbLastName.CssClass             = "form-control";
            _tbLastName.Placeholder          = "Last Name";
            _tbLastName.Required             = true;
            _tbLastName.RequiredErrorMessage = "Last Name is required for all group members";

            _dvpSuffix.CssClass      = "form-control";
            _dvpSuffix.DefinedTypeId = DefinedTypeCache.Get(new Guid(Rock.SystemGuid.DefinedType.PERSON_SUFFIX)).Id;

            _dvpConnectionStatus.CssClass             = "form-control";
            _dvpConnectionStatus.DefinedTypeId        = DefinedTypeCache.Get(new Guid(Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS)).Id;
            _dvpConnectionStatus.Required             = true;
            _dvpConnectionStatus.RequiredErrorMessage = "Connection Status is required for all group members";

            _rblGender.RepeatDirection      = RepeatDirection.Vertical;
            _rblGender.RequiredErrorMessage = "Gender is required for all group members";
            BindGender();

            _dpBirthdate.StartView  = DatePicker.StartViewOption.decade;
            _dpBirthdate.ForceParse = false;
            _dpBirthdate.AllowFutureDateSelection = false;
            _dpBirthdate.RequiredErrorMessage     = "Birthdate is required for all group members";
            _dpBirthdate.Required = false;

            _ddlGradePicker.CssClass             = "form-control";
            _ddlGradePicker.RequiredErrorMessage = "Grade is required for all children";

            var iDelete = new HtmlGenericControl("i");

            _lbDelete.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _lbDelete.CssClass         = "btn btn-square btn-danger pull-right";
            _lbDelete.Click           += lbDelete_Click;
            _lbDelete.CausesValidation = false;
        }
        /// <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();

            _phControls = new DynamicPlaceholder {
                ID = "phControls"
            };
            this.Controls.Add(_phControls);

            _pnlRow = new DynamicControlsPanel {
                ID = "pnlRow", CssClass = "row"
            };
            _pnlCol1 = new DynamicControlsPanel {
                ID = "pnlCol1", CssClass = "col-sm-4"
            };
            _pnlCol2 = new DynamicControlsPanel {
                ID = "pnlCol2", CssClass = "col-sm-4"
            };
            _pnlCol3 = new DynamicControlsPanel {
                ID = "pnlCol3", CssClass = "col-sm-4"
            };
            _phControls.Controls.Add(_pnlRow);
            _pnlRow.Controls.Add(_pnlCol1);
            _pnlRow.Controls.Add(_pnlCol2);
            _pnlRow.Controls.Add(_pnlCol3);


            _hfPersonId = new HiddenField
            {
                ID = "_hfPersonId"
            };

            _phControls.Controls.Add(_hfPersonId);

            _dvpPersonTitle = new DefinedValuePicker
            {
                ID              = "_dvpPersonTitle",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_TITLE.AsGuid()),
                Label           = "Title",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            _tbPersonFirstName = new RockTextBox
            {
                ID               = "tbPersonFirstName",
                Label            = "First Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            _tbPersonLastName = new RockTextBox
            {
                ID               = "tbPersonLastName",
                Label            = "Last Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            _dvpPersonSuffix = new DefinedValuePicker
            {
                ID              = "dvpPersonSuffix",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_SUFFIX.AsGuid()),
                Label           = "Suffix",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            // Have Email and PhoneNumber hidden by default
            _ebPersonEmail = new EmailBox
            {
                ID              = "ebPersonEmail",
                Label           = "Email",
                ValidationGroup = ValidationGroup,
                Visible         = false
            };

            _pnbMobilePhoneNumber = new PhoneNumberBox
            {
                Label   = "Mobile Phone",
                ID      = "pnbMobilePhoneNumber",
                Visible = false
            };

            _dvpPersonConnectionStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonConnectionStatus",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS.AsGuid()),
                Label           = "Connection Status",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            _rblPersonRole = new RockRadioButtonList
            {
                ID              = "rblPersonRole",
                Label           = "Role",
                RepeatDirection = RepeatDirection.Horizontal,
                DataTextField   = "Name",
                DataValueField  = "Id",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            _rblPersonGender = new RockRadioButtonList
            {
                ID              = "rblPersonGender",
                Label           = "Gender",
                RepeatDirection = RepeatDirection.Horizontal,
                Required        = this.RequireGender,
                ValidationGroup = this.RequireGender == true ? ValidationGroup : string.Empty,
                ShowNoneOption  = false
            };

            _bdpPersonBirthDate = new BirthdayPicker
            {
                ID              = "bdpPersonBirthDate",
                Label           = "Birthdate",
                ValidationGroup = ValidationGroup
            };

            _ddlGradePicker = new GradePicker
            {
                ID                    = "ddlGradePicker",
                Label                 = "Grade",
                UseAbbreviation       = true,
                UseGradeOffsetAsValue = true,
                ValidationGroup       = ValidationGroup
            };

            _dvpPersonMaritalStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonMaritalStatus",
                Label           = "Marital Status",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid()),
                ValidationGroup = ValidationGroup
            };

            var groupType = GroupTypeCache.GetFamilyGroupType();

            _rblPersonRole.DataSource = groupType.Roles.OrderBy(r => r.Order).ToList();
            _rblPersonRole.DataBind();

            _rblPersonGender.Items.Clear();
            _rblPersonGender.Items.Add(new ListItem(Gender.Male.ConvertToString(), Gender.Male.ConvertToInt().ToString()));
            _rblPersonGender.Items.Add(new ListItem(Gender.Female.ConvertToString(), Gender.Female.ConvertToInt().ToString()));

            ArrangePersonControls(this.ShowInColumns);
            UpdatePersonControlLabels();
        }
        /// <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();

            _rblRole.ID             = "_rblRole";
            _ddlTitle.ID            = "_ddlTitle";
            _tbFirstName.ID         = "_tbFirstName";
            _tbLastName.ID          = "_tbLastName";
            _ddlSuffix.ID           = "_ddlSuffix";
            _ddlConnectionStatus.ID = "_ddlConnectionStatus";
            _rblGender.ID           = "_rblGender";
            _dpBirthdate.ID         = "_dtBirthdate";
            _ddlGradePicker.ID      = "_ddlGrade";
            _lbDelete.ID            = "_lbDelete";

            Controls.Add(_rblRole);
            Controls.Add(_ddlTitle);
            Controls.Add(_tbFirstName);
            Controls.Add(_tbLastName);
            Controls.Add(_ddlSuffix);
            Controls.Add(_ddlConnectionStatus);
            Controls.Add(_rblGender);
            Controls.Add(_dpBirthdate);
            Controls.Add(_ddlGradePicker);
            Controls.Add(_lbDelete);

            _rblRole.RepeatDirection       = RepeatDirection.Vertical;
            _rblRole.AutoPostBack          = true;
            _rblRole.SelectedIndexChanged += rblRole_SelectedIndexChanged;
            _rblRole.Required              = true;
            _rblRole.RequiredErrorMessage  = "Role is required for all members";
            _rblRole.DataTextField         = "Name";
            _rblRole.DataValueField        = "Id";
            _rblRole.DataSource            = FamilyRoles;
            _rblRole.DataBind();

            _ddlTitle.CssClass = "form-control";
            BindListToDefinedType(_ddlTitle, Rock.SystemGuid.DefinedType.PERSON_TITLE, true);

            _tbFirstName.CssClass             = "form-control";
            _tbFirstName.Placeholder          = "First Name";
            _tbFirstName.Required             = true;
            _tbFirstName.RequiredErrorMessage = "First Name is required for all family members";

            _tbLastName.CssClass             = "form-control";
            _tbLastName.Placeholder          = "Last Name";
            _tbLastName.Required             = true;
            _tbLastName.RequiredErrorMessage = "Last Name is required for all family members";

            _ddlSuffix.CssClass = "form-control";
            BindListToDefinedType(_ddlSuffix, Rock.SystemGuid.DefinedType.PERSON_SUFFIX, true);

            _ddlConnectionStatus.CssClass = "form-control";
            BindListToDefinedType(_ddlConnectionStatus, Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS, true);

            _rblGender.RepeatDirection      = RepeatDirection.Vertical;
            _rblGender.RequiredErrorMessage = "Gender is required for all family members";
            BindGender();

            _dpBirthdate.StartView = DatePicker.StartViewOption.decade;
            _dpBirthdate.Required  = false;

            _ddlGradePicker.CssClass             = "form-control";
            _ddlGradePicker.RequiredErrorMessage = _ddlGradePicker.Label + " is required for all children";

            var iDelete = new HtmlGenericControl("i");

            _lbDelete.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _lbDelete.CssClass         = "btn btn-sm btn-danger";
            _lbDelete.Click           += lbDelete_Click;
            _lbDelete.CausesValidation = false;
        }
Example #5
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();

            _rblRole.ID             = "_rblRole";
            _ddlTitle.ID            = "_ddlTitle";
            _tbFirstName.ID         = "_tbFirstName";
            _tbNickName.ID          = "_tbNickName";
            _tbLastName.ID          = "_tbLastName";
            _rblGender.ID           = "_rblGender";
            _dpBirthdate.ID         = "_dtBirthdate";
            _ddlConnectionStatus.ID = "_ddlConnectionStatus";
            _ddlGrade.ID            = "_ddlGrade";
            _lbDelete.ID            = "_lbDelete";

            Controls.Add(_rblRole);
            Controls.Add(_ddlTitle);
            Controls.Add(_tbFirstName);
            Controls.Add(_tbNickName);
            Controls.Add(_tbLastName);
            Controls.Add(_rblGender);
            Controls.Add(_dpBirthdate);
            Controls.Add(_ddlConnectionStatus);
            Controls.Add(_ddlGrade);
            Controls.Add(_lbDelete);

            _rblRole.RepeatDirection       = RepeatDirection.Vertical;
            _rblRole.AutoPostBack          = true;
            _rblRole.SelectedIndexChanged += rblRole_SelectedIndexChanged;
            _rblRole.Required              = true;
            _rblRole.RequiredErrorMessage  = "Role is required for all members";
            _rblRole.DataTextField         = "Value";
            _rblRole.DataValueField        = "Key";
            _rblRole.DataSource            = FamilyRoles;
            _rblRole.DataBind();

            _ddlTitle.CssClass = "form-control";
            BindListToDefinedType(_ddlTitle, Rock.SystemGuid.DefinedType.PERSON_TITLE, true);

            _tbFirstName.CssClass             = "form-control";
            _tbFirstName.Required             = true;
            _tbFirstName.RequiredErrorMessage = "First Name is required for all family members";

            _tbNickName.CssClass = "form-control";

            _tbLastName.CssClass             = "form-control";
            _tbLastName.Required             = true;
            _tbLastName.RequiredErrorMessage = "Last Name is required for all family members";

            _rblGender.RepeatDirection      = RepeatDirection.Vertical;
            _rblGender.RequiredErrorMessage = "Gender is required for all family members";
            BindGender();

            _ddlConnectionStatus.CssClass = "form-control";
            BindListToDefinedType(_ddlConnectionStatus, Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS);

            _dpBirthdate.Required = false;

            _ddlGrade.CssClass             = "form-control";
            _ddlGrade.RequiredErrorMessage = "Grade is required for all children";
            _ddlGrade.Items.Clear();
            _ddlGrade.Items.Add(new ListItem("", ""));
            _ddlGrade.Items.Add(new ListItem("K", "0"));
            _ddlGrade.Items.Add(new ListItem("1st", "1"));
            _ddlGrade.Items.Add(new ListItem("2nd", "2"));
            _ddlGrade.Items.Add(new ListItem("3rd", "3"));
            _ddlGrade.Items.Add(new ListItem("4th", "4"));
            _ddlGrade.Items.Add(new ListItem("5th", "5"));
            _ddlGrade.Items.Add(new ListItem("6th", "6"));
            _ddlGrade.Items.Add(new ListItem("7th", "7"));
            _ddlGrade.Items.Add(new ListItem("8th", "8"));
            _ddlGrade.Items.Add(new ListItem("9th", "9"));
            _ddlGrade.Items.Add(new ListItem("10th", "10"));
            _ddlGrade.Items.Add(new ListItem("11th", "11"));
            _ddlGrade.Items.Add(new ListItem("12th", "12"));

            var iDelete = new HtmlGenericControl("i");

            _lbDelete.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _lbDelete.CssClass         = "btn btn-sm btn-danger";
            _lbDelete.Click           += lbDelete_Click;
            _lbDelete.CausesValidation = false;
        }