/// <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(); this.CssClass = "picker picker-select rollover-container"; _hfLocationId = new HiddenField { ID = "hfLocationId" }; this.Controls.Add( _hfLocationId ); _btnPickerLabel = new HtmlAnchor { ID = "btnPickerLabel" }; _btnPickerLabel.Attributes["class"] = "picker-label"; this.Controls.Add( _btnPickerLabel ); _btnSelectNone = new HtmlAnchor(); _btnSelectNone.Attributes["class"] = "picker-select-none"; _btnSelectNone.ID = string.Format( "btnSelectNone_{0}", this.ID ); _btnSelectNone.InnerHtml = "<i class='fa fa-times'></i>"; _btnSelectNone.CausesValidation = false; _btnSelectNone.Style[HtmlTextWriterStyle.Display] = "none"; _btnSelectNone.ServerClick += _btnSelectNone_ServerClick; this.Controls.Add( _btnSelectNone ); // PickerMenu (DropDown menu) _pnlPickerMenu = new Panel { ID = "pnlPickerMenu" }; _pnlPickerMenu.CssClass = "picker-menu dropdown-menu"; _pnlPickerMenu.Style[HtmlTextWriterStyle.Display] = "none"; this.Controls.Add( _pnlPickerMenu ); SetPickerOnClick(); // Address Entry _pnlAddressEntry = new Panel { ID = "pnlAddressEntry" }; _pnlAddressEntry.CssClass = "locationpicker-address-entry"; _pnlPickerMenu.Controls.Add( _pnlAddressEntry ); _tbAddress1 = new RockTextBox { ID = "tbAddress1" }; _tbAddress1.Label = "Address Line 1"; _pnlAddressEntry.Controls.Add( _tbAddress1 ); _tbAddress2 = new RockTextBox { ID = "tbAddress2" }; _tbAddress2.Label = "Address Line 2"; _pnlAddressEntry.Controls.Add( _tbAddress2 ); // Address Entry - City State Zip _divCityStateZipRow = new HtmlGenericContainer( "div", "row" ); _pnlAddressEntry.Controls.Add( _divCityStateZipRow ); _divCityColumn = new HtmlGenericContainer( "div", "col-sm-5" ); _divCityStateZipRow.Controls.Add( _divCityColumn ); _tbCity = new RockTextBox { ID = "tbCity" }; _tbCity.Label = "City"; _divCityColumn.Controls.Add( _tbCity ); _divStateColumn = new HtmlGenericContainer( "div", "col-sm-3" ); _divCityStateZipRow.Controls.Add( _divStateColumn ); _ddlState = new StateDropDownList { ID = "ddlState" }; _ddlState.UseAbbreviation = true; _ddlState.CssClass = "input-mini"; _ddlState.Label = "State"; _divStateColumn.Controls.Add( _ddlState ); _divZipColumn = new HtmlGenericContainer( "div", "col-sm-4" ); _divCityStateZipRow.Controls.Add( _divZipColumn ); _tbZip = new RockTextBox { ID = "tbZip" }; _tbZip.CssClass = "input-small"; _tbZip.Label = "Zip"; _divZipColumn.Controls.Add( _tbZip ); // picker actions _pnlPickerActions = new Panel { ID = "pnlPickerActions", CssClass = "picker-actions" }; _pnlPickerMenu.Controls.Add( _pnlPickerActions ); _btnSelect = new LinkButton { ID = "btnSelect", CssClass = "btn btn-xs btn-primary", Text = "Select", CausesValidation = false }; _btnSelect.Click += _btnSelect_Click; _pnlPickerActions.Controls.Add( _btnSelect ); _btnCancel = new LinkButton { ID = "btnCancel", CssClass = "btn btn-xs btn-link", Text = "Cancel" }; _btnCancel.OnClientClick = string.Format( "$('#{0}').hide();", _pnlPickerMenu.ClientID ); _pnlPickerActions.Controls.Add( _btnCancel ); }
/// <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(); this.CssClass = "picker picker-select"; _hfLocationId = new HiddenField { ID = "hfLocationId" }; this.Controls.Add(_hfLocationId); _btnPickerLabel = new HtmlAnchor { ID = "btnPickerLabel" }; _btnPickerLabel.Attributes["class"] = "picker-label"; _btnPickerLabel.InnerHtml = string.Format("<i class='fa fa-user'></i>{0}<b class='fa fa-caret-down pull-right'></b>", this.AddressSummaryText); this.Controls.Add(_btnPickerLabel); // PickerMenu (DropDown menu) _pnlPickerMenu = new Panel { ID = "pnlPickerMenu" }; _pnlPickerMenu.CssClass = "picker-menu dropdown-menu"; _pnlPickerMenu.Style[HtmlTextWriterStyle.Display] = "none"; this.Controls.Add(_pnlPickerMenu); SetPickerOnClick(); // Address Entry _pnlAddressEntry = new Panel { ID = "pnlAddressEntry" }; _pnlAddressEntry.CssClass = "locationpicker-address-entry"; _pnlPickerMenu.Controls.Add(_pnlAddressEntry); _tbAddress1 = new RockTextBox { ID = "tbAddress1" }; _tbAddress1.Label = "Address Line 1"; _pnlAddressEntry.Controls.Add(_tbAddress1); _tbAddress2 = new RockTextBox { ID = "tbAddress2" }; _tbAddress2.Label = "Address Line 2"; _pnlAddressEntry.Controls.Add(_tbAddress2); // Address Entry - City State Zip _divCityStateZipRow = new HtmlGenericContainer("div", "row"); _pnlAddressEntry.Controls.Add(_divCityStateZipRow); _divCityColumn = new HtmlGenericContainer("div", "col-lg-5"); _divCityStateZipRow.Controls.Add(_divCityColumn); _tbCity = new RockTextBox { ID = "tbCity" }; _tbCity.Label = "City"; _divCityColumn.Controls.Add(_tbCity); _divStateColumn = new HtmlGenericContainer("div", "col-lg-3"); _divCityStateZipRow.Controls.Add(_divStateColumn); _ddlState = new StateDropDownList { ID = "ddlState" }; _ddlState.UseAbbreviation = true; _ddlState.CssClass = "input-mini"; _ddlState.Label = "State"; _divStateColumn.Controls.Add(_ddlState); _divZipColumn = new HtmlGenericContainer("div", "col-lg-4"); _divCityStateZipRow.Controls.Add(_divZipColumn); _tbZip = new RockTextBox { ID = "tbZip" }; _tbZip.CssClass = "input-small"; _tbZip.Label = "Zip"; _divZipColumn.Controls.Add(_tbZip); // picker actions _pnlPickerActions = new Panel { ID = "pnlPickerActions", CssClass = "picker-actions" }; _pnlPickerMenu.Controls.Add(_pnlPickerActions); _btnSelect = new LinkButton { ID = "btnSelect", CssClass = "btn btn-xs btn-primary", Text = "Select", CausesValidation = false }; _btnSelect.Click += _btnSelect_Click; _pnlPickerActions.Controls.Add(_btnSelect); _btnCancel = new LinkButton { ID = "btnCancel", CssClass = "btn btn-xs btn-link", Text = "Cancel" }; _btnCancel.OnClientClick = string.Format("$('#{0}').hide();", _pnlPickerMenu.ClientID); _pnlPickerActions.Controls.Add(_btnCancel); }