/// <summary> /// Renders the base control. /// </summary> /// <param name="writer">The writer.</param> public void RenderBaseControl(HtmlTextWriter writer) { RegisterJavaScript(); // controls div writer.AddAttribute("class", "controls"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _hfGeoDisplayName.RenderControl(writer); _hfGeoPath.RenderControl(writer); if (this.Enabled) { writer.AddAttribute("id", this.ClientID.ToString()); writer.AddAttribute("class", "picker picker-geography rollover-container"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write(string.Format(@" <a class='picker-label' href='#'> <i class='fa fa-map-marker'></i> <span id='selectedGeographyLabel_{0}'>{1}</span> <b class='fa fa-caret-down pull-right'></b> </a>", this.ClientID, this.GeoDisplayName)); writer.WriteLine(); _btnSelectNone.RenderControl(writer); // picker menu writer.AddAttribute("class", "picker-menu dropdown-menu"); if (ShowDropDown) { writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "block"); } writer.RenderBeginTag(HtmlTextWriterTag.Div); // mode panel if (ModePanel != null) { ModePanel.RenderControl(writer); } // map writer.Write(@" <h4>Geography Picker <a class='pull-right btn btn-link btn-minimal' title='Toggle Fullscreen' id='btnExpandToggle_{0}'><i class='fa fa-expand'></i></a></h4> <!-- Our custom delete button that we add to the map for deleting polygons. --> <div style='display:none; z-index: 10; position: absolute; left: 200px; margin-top: 5px; line-height:0;' id='gmnoprint-delete-button_{0}'> <div onmouseover=""this.style.background='WhiteSmoke';"" onmouseout=""this.style.background='white';""style='direction: ltr; overflow: hidden; text-align: left; position: relative; color: rgb(140, 75, 75); font-family: Arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); padding: 4px; border-radius: 2px; -webkit-background-clip: padding-box; background-clip: padding-box; -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; font-weight: 500; background-position: initial initial; background-repeat: initial initial;' title='Delete selected shape'> <span style='display: inline-block;'><div style='width: 16px; height: 16px; overflow: hidden; position: relative;'><i class='fa fa-times' style='font-size: 16px; padding-left: 2px; color: #aaa;'></i></div></span> </div> </div> <!-- This is where the Google Map (with Drawing Tools) will go. --> <div id='geoPicker_{0}' style='height: 300px; width: 500px' ></div>", this.ClientID); writer.WriteLine(); // picker actions writer.AddAttribute("class", "picker-actions"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _btnSelect.RenderControl(writer); writer.Write("<a class='btn btn-link btn-xs' id='btnCancel_{0}'>Cancel</a>", this.ClientID); writer.WriteLine(); writer.RenderEndTag(); // closing div of picker-menu writer.RenderEndTag(); // closing div of picker writer.RenderEndTag(); } else { // this picker is not enabled (readonly), so just render a readonly version writer.AddAttribute("class", "picker picker-select"); writer.RenderBeginTag(HtmlTextWriterTag.Div); LinkButton linkButton = new LinkButton(); linkButton.CssClass = "picker-label"; linkButton.Text = string.Format("<i class='{1}'></i><span>{0}</span>", this.GeoDisplayName, "fa fa-map-marker"); linkButton.Enabled = false; linkButton.RenderControl(writer); writer.WriteLine(); writer.RenderEndTag(); } // controls div writer.RenderEndTag(); }
/// <summary> /// This is where you implment the simple aspects of rendering your control. The rest /// will be handled by calling RenderControlHelper's RenderControl() method. /// </summary> /// <param name="writer">The writer.</param> public virtual void RenderBaseControl(HtmlTextWriter writer) { if (this.Enabled) { writer.AddAttribute("id", this.ClientID.ToString()); writer.AddAttribute("class", "picker picker-select rollover-container " + this.CssClass); writer.RenderBeginTag(HtmlTextWriterTag.Div); _hfItemId.RenderControl(writer); _hfInitialItemParentIds.RenderControl(writer); _hfItemName.RenderControl(writer); _hfItemRestUrlExtraParams.RenderControl(writer); if (!HidePickerLabel) { string pickerLabelHtmlFormat = @" <a class='picker-label' href='#'> <i class='{2} fa-fw'></i> <span id='selectedItemLabel_{0}' class='selected-names'>{1}</span> <b class='fa fa-caret-down pull-right'></b> </a>"; writer.Write(pickerLabelHtmlFormat, this.ClientID, this.ItemName, this.IconCssClass); writer.WriteLine(); _btnSelectNone.RenderControl(writer); } // picker menu writer.AddAttribute("class", "picker-menu dropdown-menu"); if (ShowDropDown) { writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "block"); } writer.RenderBeginTag(HtmlTextWriterTag.Div); // mode panel if (ModePanel != null) { ModePanel.RenderControl(writer); } // treeview writer.Write( @"<div id='treeview-scroll-container_{0}' class='scroll-container scroll-container-vertical scroll-container-picker'> <div class='scrollbar'> <div class='track'> <div class='thumb'> <div class='end'></div> </div> </div> </div> <div class='viewport'> <div class='overview'> <div id='treeviewItems_{0}' class='treeview treeview-items'></div> </div> </div> </div>", this.ClientID); // picker actions writer.AddAttribute("class", "picker-actions"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _btnSelect.RenderControl(writer); writer.Write("<a class='btn btn-xs btn-link picker-cancel' id='btnCancel_{0}'>Cancel</a>", this.ClientID); // render any additional picker actions that a child class if ItemPicker implements RenderCustomPickerActions(writer); writer.WriteLine(); writer.RenderEndTag(); // closing div of picker-menu writer.RenderEndTag(); // closing div of picker writer.RenderEndTag(); RegisterJavaScript(); } else { // this picker is not enabled (readonly), so just render a readonly version writer.AddAttribute("class", "picker picker-select"); writer.RenderBeginTag(HtmlTextWriterTag.Div); LinkButton linkButton = new LinkButton(); linkButton.CssClass = "picker-label"; linkButton.Text = string.Format("<i class='{1}'></i><span>{0}</span>", this.ItemName, this.IconCssClass); linkButton.Enabled = false; linkButton.RenderControl(writer); writer.WriteLine(); writer.RenderEndTag(); } }