/// <summary> /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param> public void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("id", this.ClientID.ToString()); writer.AddAttribute("class", "toggle-container " + this.CssClass); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "btn-group btn-toggle " + this.CssClass); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (this.Checked) { _btnOn.AddCssClass(this.ActiveButtonCssClass + " " + this.OnCssClass + " active"); //_btnOff.RemoveCssClass( this.OffCssClass ); } else { _btnOff.AddCssClass(this.ActiveButtonCssClass + " " + this.OffCssClass + " active"); //_btnOn.RemoveCssClass( this.OnCssClass ); } _btnOn.RenderControl(writer); _btnOff.RenderControl(writer); writer.RenderEndTag(); _hfChecked.RenderControl(writer); writer.RenderEndTag(); RegisterJavascript(); }
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer) { writer.AddAttribute(HtmlTextWriterAttribute.Id, "traceContainer"); writer.RenderBeginTag(HtmlTextWriterTag.Div); var linkToggle = new HtmlAnchor { HRef = "#", ID = "lnkToggleView", InnerText = "toggle" }; linkToggle.RenderControl(writer); btnClear.RenderControl(writer); const string contentPlaceholder = @"<table id='traceTable'><td><b>Start</b></td><td><b>Duration</b></td><td><b>Query</b></td></table>"; writer.Write(contentPlaceholder); writer.Write(GetTraceTemplate()); writer.Write(GetTraceAsJson()); writer.Write(GetToggleJavascript()); writer.RenderEndTag(); // div base.RenderContents(writer); }
/// <summary> /// Renders a label and <see cref="T:System.Web.UI.WebControls.TextBox"/> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter"/> object. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> that receives the rendered output.</param> public override void RenderControl(HtmlTextWriter writer) { writer.AddAttribute("class", "rock-image"); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (!string.IsNullOrEmpty(ImageId) && ImageId != "0") { image.Style["display"] = "inline"; image.ImageUrl = "~/image.ashx?" + ImageId + "&width=50&height=50"; } else { image.Style["display"] = "none"; image.ImageUrl = string.Empty; } image.RenderControl(writer); hiddenField.RenderControl(writer); htmlAnchor.RenderControl(writer); writer.RenderBeginTag(HtmlTextWriterTag.Div); fileUpload.Attributes["name"] = string.Format("{0}[]", base.ID); fileUpload.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); }
protected override void RenderEndTag(HtmlTextWriter writer) { _menuPanel.RenderEndTag(writer); // skip link if (Control.SkipLinkText.Length != 0) { HtmlAnchor skipAnchor = new HtmlAnchor(); skipAnchor.Name = Control.ClientID + "_SkipLink"; skipAnchor.Page = Page; skipAnchor.RenderControl(writer); } }
/// <summary> /// Return a link to the profile wrapped inside a display name /// </summary> /// <param name="userId"></param> /// <param name="displayName"></param> /// <returns></returns> public static string GetProfileLink(int userId, string displayName) { StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); HtmlAnchor a = new HtmlAnchor(); a.HRef = String.Format(Constants.UserProfilePath, userId.ToString()); //a.HRef = String.Format(a.HRef, Constants.UserDefaultTab); a.InnerText = displayName; a.RenderControl(htw); return(sw.ToString()); }
/// <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 void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("class", "fileupload-group"); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (BinaryFileId != null) { _aFileName.HRef = string.Format("{0}GetFile.ashx?id={1}", ResolveUrl("~"), BinaryFileId); _aFileName.InnerText = new BinaryFileService().Queryable().Where(f => f.Id == BinaryFileId).Select(f => f.FileName).FirstOrDefault(); _aFileName.AddCssClass("file-exists"); _aRemove.Style[HtmlTextWriterStyle.Display] = "inline"; } else { _aFileName.HRef = string.Empty; _aFileName.InnerText = string.Empty; _aFileName.RemoveCssClass("file-exists"); _aRemove.Style[HtmlTextWriterStyle.Display] = "none"; } writer.AddAttribute("class", "fileupload-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _hfBinaryFileId.RenderControl(writer); _hfBinaryFileTypeGuid.RenderControl(writer); _aFileName.RenderControl(writer); writer.RenderEndTag(); writer.AddAttribute("class", "fileupload-remove"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _aRemove.RenderControl(writer); writer.RenderEndTag(); // render drop zone writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileupload-dropzone"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write("drop / click to upload"); writer.RenderEndTag(); _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID); _fileUpload.RenderControl(writer); writer.RenderEndTag(); RegisterStartupScript(); 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 void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("class", "imageupload-group"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "imageupload-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (BinaryFileId != null) { _imgThumbnail.ImageUrl = "~/GetImage.ashx?id=" + BinaryFileId.ToString() + "&width=50"; _aRemove.Style[HtmlTextWriterStyle.Display] = "inline"; } else { _imgThumbnail.ImageUrl = "/Assets/Images/no-picture.svg"; _aRemove.Style[HtmlTextWriterStyle.Display] = "none"; } _imgThumbnail.RenderControl(writer); _hfBinaryFileId.RenderControl(writer); _hfBinaryFileTypeGuid.RenderControl(writer); writer.RenderEndTag(); writer.AddAttribute("class", "imageupload-remove"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _aRemove.RenderControl(writer); writer.RenderEndTag(); writer.AddAttribute("class", "imageupload-dropzone"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write("drop / click to upload"); writer.RenderEndTag(); _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID); _fileUpload.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); }
private static string GenerateStopSurveyLink() { var result = new StringBuilder(); using (var stringWriter = new StringWriter()) { using (var htmlWriter = new HtmlTextWriter(stringWriter)) { var surveyLink = new HtmlAnchor { HRef = "https://www.smartsurvey.co.uk/s/stoppingapprentices/", Target = "_blank", InnerText = "Complete our survey" }; surveyLink.Attributes.Add("id", "stop-survey-link"); surveyLink.Attributes.Add("rel", "noopener noreferrer"); surveyLink.Attributes.Add("aria-label", "Complete our survey"); surveyLink.RenderControl(htmlWriter); } result.Append(stringWriter); } return(result.ToString()); }
/// <summary> /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param> public void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("id", this.ClientID.ToString()); writer.AddAttribute("class", "toggle-container " + this.CssClass); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", $"btn-group btn-toggle {this.ButtonGroupCssClass}"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _btnOn.Attributes["class"] = "btn btn-default js-toggle-on " + this.ButtonSizeCssClass; _btnOn.InnerHtml = this.OnText; _btnOff.Attributes["class"] = "btn btn-default js-toggle-off " + this.ButtonSizeCssClass; _btnOff.InnerHtml = this.OffText; if (this.Checked) { _btnOn.AddCssClass(this.ActiveButtonCssClass + " " + this.OnCssClass + " active"); //_btnOff.RemoveCssClass( this.OffCssClass ); } else { _btnOff.AddCssClass(this.ActiveButtonCssClass + " " + this.OffCssClass + " active"); //_btnOn.RemoveCssClass( this.OnCssClass ); } _btnOff.RenderControl(writer); _btnOn.RenderControl(writer); writer.RenderEndTag(); _hfChecked.RenderControl(writer); writer.RenderEndTag(); RegisterJavascript(); }
/// <summary> /// This is where you implement 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 void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("class", "fileupload-group"); writer.AddAttribute("id", this.ClientID); if (ToolTip.IsNotNullOrWhiteSpace()) { writer.AddAttribute("title", ToolTip); } writer.RenderBeginTag(HtmlTextWriterTag.Div); if (BinaryFileId != null || !string.IsNullOrWhiteSpace(this.UploadedContentFilePath)) { if (IsBinaryFile) { _aFileName.HRef = string.Format("{0}GetFile.ashx?id={1}", ResolveUrl("~"), BinaryFileId); _aFileName.InnerText = new BinaryFileService(new RockContext()).Queryable().Where(f => f.Id == BinaryFileId).Select(f => f.FileName).FirstOrDefault(); } else { _aFileName.HRef = ResolveUrl(this.UploadedContentFilePath); _aFileName.InnerText = this.UploadedContentFilePath; } _aFileName.AddCssClass("file-exists"); _aRemove.Style[HtmlTextWriterStyle.Display] = "block"; } else { _aFileName.HRef = string.Empty; _aFileName.InnerText = string.Empty; _aFileName.RemoveCssClass("file-exists"); _aRemove.Style[HtmlTextWriterStyle.Display] = "none"; } if (this.Enabled) { if (this.DisplayMode == UploaderDisplayMode.DropZone) { writer.AddAttribute("class", "fileupload-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _hfBinaryFileId.RenderControl(writer); _hfBinaryFileTypeGuid.RenderControl(writer); _aFileName.RenderControl(writer); writer.AddAttribute("class", "fileupload-remove"); if (!ShowDeleteButton) { writer.AddStyleAttribute(HtmlTextWriterStyle.Visibility, "hidden"); } writer.RenderBeginTag(HtmlTextWriterTag.Div); _aRemove.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); } string uploadClass = this.DisplayMode == UploaderDisplayMode.DefaultButton ? "upload-progress-sm" : "upload-progress"; string spinnerSize = this.DisplayMode == UploaderDisplayMode.DefaultButton ? "fa-lg" : "fa-3x"; writer.Write($@" <div class='js-upload-progress {uploadClass}' style='display:none;'> <i class='fa fa-refresh {spinnerSize} fa-spin'></i> <div class='js-upload-progress-percent'></div> </div>"); if (this.DisplayMode == UploaderDisplayMode.Button) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileupload-button"); } else if (this.DisplayMode == UploaderDisplayMode.DefaultButton) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileuploaddefault-button"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileupload-dropzone"); } writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write(this.UploadButtonText); writer.RenderEndTag(); _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID); _fileUpload.RenderControl(writer); writer.RenderEndTag(); } RegisterStartupScript(); writer.RenderEndTag(); }
/// <summary> /// Renders the <see cref="T:System.Web.UI.WebControls.TextBox" /> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> that receives the rendered output.</param> public void RenderBaseControl(HtmlTextWriter writer) { if (this.Enabled) { writer.AddAttribute("id", this.ClientID); writer.AddAttribute("class", string.Format("picker picker-select picker-person {0}", this.CssClass)); writer.RenderBeginTag(HtmlTextWriterTag.Div); _hfPersonId.RenderControl(writer); _hfPersonName.RenderControl(writer); _hfIncludeBusinesses.RenderControl(writer); string pickerLabelHtmlFormat = @" <a class='picker-label' href='#'> <i class='fa fa-user'></i> <span id='{0}_selectedPersonLabel' class='picker-selectedperson'>{1}</span> <b class='fa fa-caret-down pull-right'></b> </a> "; writer.Write(string.Format(pickerLabelHtmlFormat, this.ClientID, this.PersonName)); _btnSelectNone.RenderControl(writer); string pickMenuHtmlFormatStart = @" <div class='picker-menu dropdown-menu'> <h4>Search</h4> <input id='{0}_personPicker' type='text' class='picker-search form-control input-sm' /> <hr /> <h4>Results</h4> <ul class='picker-select' id='{0}_personPickerItems'> </ul> <div class='picker-actions'> "; writer.Write(pickMenuHtmlFormatStart, this.ClientID, this.PersonName); _btnSelect.RenderControl(writer); string pickMenuHtmlFormatEnd = @" <a class='btn btn-link btn-xs' id='{0}_btnCancel'>Cancel</a> </div> </div> "; writer.Write(string.Format(pickMenuHtmlFormatEnd, this.ClientID, this.PersonName)); 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.PersonName, "fa fa-user"); linkButton.Enabled = false; linkButton.RenderControl(writer); writer.WriteLine(); writer.RenderEndTag(); } }
/// <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(); } }
/// <summary> /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param> public override void RenderControl(HtmlTextWriter writer) { var noteType = NoteTypeId.HasValue ? NoteTypeCache.Get(NoteTypeId.Value) : null; StringBuilder noteCss = new StringBuilder(); noteCss.Append("note-editor js-note-editor meta"); if (!string.IsNullOrEmpty(this.CssClass)) { noteCss.Append(" " + this.CssClass); } writer.AddAttribute(HtmlTextWriterAttribute.Class, noteCss.ToString()); if (this.Style[HtmlTextWriterStyle.Display] != null) { writer.AddStyleAttribute(HtmlTextWriterStyle.Display, this.Style[HtmlTextWriterStyle.Display]); } if (!ShowEditMode) { writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none"); } if (this.NoteId.HasValue) { writer.AddAttribute("rel", this.NoteId.Value.ToStringSafe()); } writer.RenderBeginTag(HtmlTextWriterTag.Div); // Edit Mode HTML... if (NoteOptions.DisplayType == NoteDisplayType.Full && NoteOptions.UsePersonIcon) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "meta-figure"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "avatar avatar-lg"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write(Person.GetPersonPhotoImageTag(CreatedByPersonId, CreatedByPhotoId, null, CreatedByGender, null, 50, 50)); writer.RenderEndTag(); // avatar div writer.RenderEndTag(); // meta-figure div } writer.AddAttribute(HtmlTextWriterAttribute.Class, "meta-body"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "noteentry-control"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _tbNote.RenderControl(writer); _hfNoteId.RenderControl(writer); _hfParentNoteId.RenderControl(writer); writer.RenderEndTag(); // Options writer.AddAttribute(HtmlTextWriterAttribute.Class, "settings clearfix"); writer.RenderBeginTag(HtmlTextWriterTag.Div); // The optional create date text box, but only for new notes... if (NoteOptions.ShowCreateDateInput && !NoteId.HasValue) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "createDate"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _dtCreateDate.RenderControl(writer); writer.RenderEndTag(); // createDate div } _ddlNoteType.RenderControl(writer); _hfHasUnselectableNoteType.RenderControl(writer); if (NoteOptions.DisplayType == NoteDisplayType.Full) { if (NoteOptions.ShowAlertCheckBox) { _cbAlert.RenderControl(writer); } if (NoteOptions.ShowPrivateCheckBox) { _cbPrivate.RenderControl(writer); } } writer.AddAttribute(HtmlTextWriterAttribute.Class, "commands"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _mdEditWarning.RenderControl(writer); if (NoteOptions.DisplayType == NoteDisplayType.Full) { if (NoteOptions.ShowSecurityButton) { _aSecurity.Attributes["data-title"] = this.Label; _aSecurity.RenderControl(writer); } } writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note-cancel js-editnote-cancel btn btn-link btn-xs"); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write("Cancel"); writer.RenderEndTag(); _lbSaveNote.Text = "Save " + Label; _lbSaveNote.CommandName = "SaveNote"; _lbSaveNote.CommandArgument = this.NoteId.ToString(); _lbSaveNote.RenderControl(writer); writer.RenderEndTag(); // commands div writer.RenderEndTag(); // settings div writer.RenderEndTag(); // panel body writer.RenderEndTag(); // ???? }
/// <summary> /// This is where you implement 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 void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("id", this.ClientID); writer.AddAttribute("class", "imageupload-group"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("style", String.Format("width: {0}px; height: {1}px;", this.ThumbnailWidth, this.ThumbnailHeight)); writer.AddAttribute("class", "imageupload-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); string thumbnailImageUrl = this.NoPictureUrl; if (IsBinaryFile && BinaryFileId.HasValue) { thumbnailImageUrl = System.Web.VirtualPathUtility.ToAbsolute("~/GetImage.ashx?id=" + BinaryFileId.ToString()); _aRemove.Style[HtmlTextWriterStyle.Display] = "block"; writer.AddAttribute(HtmlTextWriterAttribute.Href, thumbnailImageUrl); writer.AddAttribute(HtmlTextWriterAttribute.Target, "_blank"); writer.RenderBeginTag(HtmlTextWriterTag.A); thumbnailImageUrl += "&width=500"; } else if (NonBinaryFileSrc.IsNotNullOrWhiteSpace()) { string physicalFile = this.Page.Request.MapPath(NonBinaryFileSrc); if (File.Exists(physicalFile)) { thumbnailImageUrl = System.Web.VirtualPathUtility.ToAbsolute(NonBinaryFileSrc); _aRemove.Style[HtmlTextWriterStyle.Display] = "block"; } else { _aRemove.Style[HtmlTextWriterStyle.Display] = "none"; } } else { _aRemove.Style[HtmlTextWriterStyle.Display] = "none"; } writer.AddAttribute("style", string.Format("background-image: url({0});", thumbnailImageUrl)); writer.AddAttribute("class", "imageupload-thumbnail-image"); writer.AddAttribute("id", this.ClientID + "-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderEndTag(); if (BinaryFileId != null) { writer.RenderEndTag(); } _hfBinaryFileId.RenderControl(writer); _hfBinaryFileTypeGuid.RenderControl(writer); _hfContentFileSource.RenderControl(writer); writer.AddAttribute("class", "imageupload-remove"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _aRemove.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); writer.Write(@" <div class='js-upload-progress upload-progress' style='display:none'> <i class='fa fa-refresh fa-3x fa-spin'></i> </div>"); writer.AddAttribute("class", "imageupload-dropzone"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write("Upload"); writer.RenderEndTag(); _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID); _fileUpload.RenderControl(writer); writer.RenderEndTag(); RegisterStartupScript(); 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 void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("class", "fileupload-group"); writer.AddAttribute("id", this.ClientID); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (BinaryFileId != null || !string.IsNullOrWhiteSpace(this.UploadedContentFilePath)) { if (IsBinaryFile) { _aFileName.HRef = string.Format("{0}GetFile.ashx?id={1}", ResolveUrl("~"), BinaryFileId); _aFileName.InnerText = new BinaryFileService(new RockContext()).Queryable().Where(f => f.Id == BinaryFileId).Select(f => f.FileName).FirstOrDefault(); } else { _aFileName.HRef = string.Format("{0}GetFile.ashx?isBinaryFile=F&rootFolder={1}&fileName={2}", ResolveUrl("~"), Rock.Security.Encryption.EncryptString(this.RootFolder), BinaryFileId); _aFileName.InnerText = this.UploadedContentFilePath; } _aFileName.AddCssClass("file-exists"); _aRemove.Style[HtmlTextWriterStyle.Display] = "block"; } else { _aFileName.HRef = string.Empty; _aFileName.InnerText = string.Empty; _aFileName.RemoveCssClass("file-exists"); _aRemove.Style[HtmlTextWriterStyle.Display] = "none"; } if (this.Enabled) { if (this.DisplayMode == UploaderDisplayMode.DropZone) { writer.AddAttribute("class", "fileupload-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _hfBinaryFileId.RenderControl(writer); _hfBinaryFileTypeGuid.RenderControl(writer); _aFileName.RenderControl(writer); writer.AddAttribute("class", "fileupload-remove"); if (!ShowDeleteButton) { writer.AddStyleAttribute(HtmlTextWriterStyle.Visibility, "hidden"); } writer.RenderBeginTag(HtmlTextWriterTag.Div); _aRemove.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); } writer.Write(@" <div class='js-upload-progress upload-progress' style='display:none;'> <i class='fa fa-refresh fa-3x fa-spin'></i> </div>"); if (this.DisplayMode == UploaderDisplayMode.Button) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileupload-button"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Class, "fileupload-dropzone"); } writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Span); if (this.DisplayMode == UploaderDisplayMode.Button) { writer.Write("Upload File"); } else { writer.Write("Upload"); } writer.RenderEndTag(); _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID); _fileUpload.RenderControl(writer); writer.RenderEndTag(); } RegisterStartupScript(); 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 void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("id", this.ClientID); writer.AddAttribute("class", "imageupload-group"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("style", String.Format("width: {0}px; height: {1}px;", this.ThumbnailWidth, this.ThumbnailHeight)); writer.AddAttribute("class", "imageupload-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); string thumbnailImage = this.NoPictureUrl; if (BinaryFileId != null) { thumbnailImage = System.Web.VirtualPathUtility.ToAbsolute("~/GetImage.ashx?id=" + BinaryFileId.ToString() + "&width=500"); _aRemove.Style[HtmlTextWriterStyle.Display] = "block"; } else { _aRemove.Style[HtmlTextWriterStyle.Display] = "none"; } writer.AddAttribute("style", string.Format("background-image: url({0});", thumbnailImage)); writer.AddAttribute("class", "imageupload-thumbnail-image"); writer.AddAttribute("id", this.ClientID + "-thumbnail"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderEndTag(); _hfBinaryFileId.RenderControl(writer); _hfBinaryFileTypeGuid.RenderControl(writer); writer.AddAttribute("class", "imageupload-remove"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _aRemove.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); writer.Write(@" <div class='js-upload-progress upload-progress' style='display:none'> <i class='fa fa-refresh fa-3x fa-spin'></i> </div>"); writer.AddAttribute("class", "imageupload-dropzone"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write("Upload"); writer.RenderEndTag(); _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID); _fileUpload.RenderControl(writer); writer.RenderEndTag(); RegisterStartupScript(); writer.RenderEndTag(); }
/// <summary> /// This is where you implement 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 void RenderBaseControl(HtmlTextWriter writer) { writer.AddAttribute("id", this.ClientID); writer.AddAttribute("class", "image-editor-group imageupload-group"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "image-editor-photo"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write(@" <div class='js-upload-progress' style='display:none'> <i class='fa fa-refresh fa-3x fa-spin'></i> </div>"); string backgroundImageFormat = "<div class='image-container' id='{0}' style='background-image:url({1});background-size:cover;background-position:50%'></div>"; string imageDivHtml = ""; if (BinaryFileId != null) { imageDivHtml = string.Format(backgroundImageFormat, this.ClientID + "_divPhoto", this.ResolveUrl("~/GetImage.ashx?id=" + BinaryFileId.ToString() + "&width=150")); } else { imageDivHtml = string.Format(backgroundImageFormat, this.ClientID + "_divPhoto", this.NoPictureUrl); } writer.Write(imageDivHtml); writer.WriteLine(); if (string.IsNullOrEmpty(ButtonCssClass)) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "options"); } writer.RenderBeginTag(HtmlTextWriterTag.Div); // We only show the Modal/Editor if the delete button is enabled and // we have a file already. if (ShowDeleteButton && (BinaryFileId ?? 0) > 0) { _lbShowModal.Style[HtmlTextWriterStyle.Display] = string.Empty; _lbUploadImage.Style[HtmlTextWriterStyle.Display] = "none"; } else { _lbShowModal.Style[HtmlTextWriterStyle.Display] = "none"; _lbUploadImage.Style[HtmlTextWriterStyle.Display] = string.Empty; } _lbShowModal.RenderControl(writer); _lbUploadImage.Text = this.ButtonText; _lbUploadImage.CssClass = this.ButtonCssClass; _lbUploadImage.Attributes["onclick"] = "return false;"; _lbUploadImage.RenderControl(writer); // render the circle check status for when save happens writer.WriteLine(); _lSaveStatus.RenderControl(writer); // Don't render the _aRemove control if there is no BinaryFile to remove. if (BinaryFileId != null) { writer.WriteLine(); _aRemove.RenderControl(writer); } writer.WriteLine(); writer.RenderEndTag(); writer.WriteLine(); _hfBinaryFileId.RenderControl(writer); writer.WriteLine(); _hfOriginalBinaryFileId.RenderControl(writer); writer.WriteLine(); _hfCropBinaryFileId.RenderControl(writer); writer.WriteLine(); _hfBinaryFileTypeGuid.RenderControl(writer); writer.WriteLine(); writer.AddAttribute("class", "image-editor-fileinput"); writer.RenderBeginTag(HtmlTextWriterTag.Div); _fileUpload.Attributes["name"] = string.Format("{0}[]", this.ID); _fileUpload.RenderControl(writer); writer.RenderEndTag(); writer.WriteLine(); writer.RenderEndTag(); // image-editor-photo writer.WriteLine(); writer.RenderEndTag(); // image-editor-group _mdImageDialog.RenderControl(writer); RegisterStartupScript(); }
/// <summary> /// Renders the <see cref="T:System.Web.UI.WebControls.TextBox" /> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> that receives the rendered output.</param> public void RenderBaseControl(HtmlTextWriter writer) { if (this.Enabled) { writer.AddAttribute("id", this.ClientID); writer.AddAttribute("class", string.Format("picker picker-select picker-person {0}", this.CssClass)); writer.RenderBeginTag(HtmlTextWriterTag.Div); _hfPersonId.RenderControl(writer); _hfPersonName.RenderControl(writer); _hfSelfPersonId.RenderControl(writer); _hfSelfPersonName.RenderControl(writer); _hfIncludeBusinesses.RenderControl(writer); string pickerLabelHtmlFormat = @" <a class='picker-label' href='#'> <i class='fa fa-user'></i> <span id='{0}_selectedPersonLabel' class='picker-selectedperson'>{1}</span> <b class='fa fa-caret-down pull-right'></b> </a> "; writer.Write(string.Format(pickerLabelHtmlFormat, this.ClientID, this.PersonName)); _btnSelectNone.RenderControl(writer); // render picker-menu dropdown-menu writer.AddAttribute(HtmlTextWriterAttribute.Class, "picker-menu dropdown-menu"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "row"); writer.RenderBeginTag(HtmlTextWriterTag.Div); // column1 writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write("<h4>Search</h4>"); writer.RenderEndTag(); // column2 writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6"); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (this.EnableSelfSelection) { writer.Write(@" <span class='js-select-self' title='Select self'> <i class='fa fa-user pull-right clickable' ></i> </span>"); } writer.RenderEndTag(); // row writer.RenderEndTag(); string pickMenuHtmlFormatStart = @" <input id='{0}_personPicker' type='text' class='picker-search form-control input-sm' /> <hr /> <h4>Results</h4> <div id='personpicker-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'> <ul class='picker-select' id='{0}_personPickerItems'> </ul> </div> </div> </div> <div class='picker-actions'> "; writer.Write(pickMenuHtmlFormatStart, this.ClientID); _btnSelect.RenderControl(writer); string pickMenuHtmlFormatEnd = @" <a class='btn btn-link btn-xs' id='{0}_btnCancel'>Cancel</a> </div> "; writer.Write(string.Format(pickMenuHtmlFormatEnd, this.ClientID)); // picker-menu dropdown-menu writer.RenderEndTag(); // picker picker-select picker-person 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.PersonName, "fa fa-user"); linkButton.Enabled = false; linkButton.RenderControl(writer); writer.WriteLine(); writer.RenderEndTag(); } }
protected override void RenderContents(HtmlTextWriter writer) { _innerTbx.Attributes.Add("Align", "AbsMiddle"); _innerTbx.Attributes.Add("onBlur", "CheckIsClickableDate('" + _innerTbx.ClientID.Replace("$", "_") + "');"); _innerTbx.Style.Add("width", "90px"); _innerTbx.RenderControl(writer); string innerid = this.ClientID + "_inner"; string PeriodsDivID = this.ClientID + "_Periods"; string CurrDateID = this.ClientID + "_CurrDate"; string MonthSpanID = this.ClientID + "_CurrMonth"; writer.AddAttribute("Align", "AbsMiddle"); writer.AddAttribute("src", ((string)ViewState["DatePicker_ImageDir"]) + "/dropdownbtn.gif"); string RenderPeriodMethod = "RenderPeriodMonths('" + CurrDateID.Replace("$", "_") + "','" + PeriodsDivID + "','" + _innerTbx.ClientID.Replace("$", "_") + "','" + innerid + "','" + MonthSpanID + "','sfdg');"; writer.AddAttribute("onClick", RenderPeriodMethod + "__datepicker_showpopup('" + innerid + "'); "); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); if (errorText != null) { writer.AddStyleAttribute("color", "red"); writer.AddStyleAttribute("display", "block"); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write(errorText); writer.RenderEndTag(); } writer.AddStyleAttribute("position", "relative"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "drop_down_panel"); string panelvisible = _panelvisible ? "block" : "none"; writer.AddStyleAttribute("display", panelvisible); writer.AddAttribute("id", innerid); writer.AddAttribute("onfocusout", "__popup_losefocus(this)"); writer.RenderBeginTag(HtmlTextWriterTag.Div); HtmlInputHidden CurrDate = new HtmlInputHidden(); CurrDate.ID = CurrDateID; CurrDate.Value = _beginDate; CurrDate.RenderControl(writer); writer.AddAttribute("class", "calendar_header"); writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.AddAttribute("colspan", "3"); writer.AddStyleAttribute("text-align", "right"); writer.RenderBeginTag(HtmlTextWriterTag.Td); HtmlAnchor CloseCalendar = new HtmlAnchor(); CloseCalendar.InnerHtml = "<img class=\"calendar_close_button\" src='" + ((string)ViewState["DatePicker_ImageDir"]) + "/close_button.gif' border='0'>"; CloseCalendar.Attributes.Add("onclick", "document.getElementById('" + innerid + "').style.display='none'"); CloseCalendar.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.AddStyleAttribute("text-align", "left"); writer.RenderBeginTag(HtmlTextWriterTag.Td); HtmlAnchor PrevMonth = new HtmlAnchor(); PrevMonth.InnerText = "< Prev"; PrevMonth.Attributes.Add("class", "prev_month_link"); PrevMonth.Attributes.Add("onclick", "RenderPeriodMonths('" + CurrDate.ID.Replace("$", "_") + "','" + PeriodsDivID + "','" + _innerTbx.ClientID.Replace("$", "_") + "','" + innerid + "','" + MonthSpanID + "','prev');"); PrevMonth.RenderControl(writer); writer.RenderEndTag(); writer.AddAttribute("class", "month_label"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.AddAttribute("id", MonthSpanID); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write(" "); //put some space as a default writer.RenderEndTag(); writer.RenderEndTag(); writer.AddStyleAttribute("text-align", "right"); writer.RenderBeginTag(HtmlTextWriterTag.Td); HtmlAnchor NextMonth = new HtmlAnchor(); NextMonth.InnerText = "Next >"; NextMonth.Attributes.Add("class", "next_month_link"); NextMonth.Attributes.Add("onclick", "RenderPeriodMonths('" + CurrDate.ID.Replace("$", "_") + "','" + PeriodsDivID + "','" + _innerTbx.ClientID.Replace("$", "_") + "','" + innerid + "','" + MonthSpanID + "','next');"); NextMonth.RenderControl(writer); writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderEndTag(); writer.AddAttribute("id", PeriodsDivID); writer.AddAttribute("class", "period_days"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderEndTag(); //render the panel controls writer.RenderEndTag(); writer.RenderEndTag(); }