RenderControl() public méthode

Outputs server control content to a provided T:System.Web.UI.HtmlTextWriter object and stores tracing information about the control if tracing is enabled.
public RenderControl ( System.Web.UI.HtmlTextWriter writer ) : void
writer System.Web.UI.HtmlTextWriter The object that receives the control content.
Résultat void
Exemple #1
0
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _tbName.RenderControl(writer);
            writer.RenderEndTag();  // col-md-6

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _cbIsActive.RenderControl(writer);
            _tbUrlSlug.RenderControl(writer);
            writer.RenderEndTag();  // col-md-6

            writer.RenderEndTag();  // row

            _ceDetails.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _dtpStart.RenderControl(writer);
            _dtpEnd.RenderControl(writer);
            _nbMaxAttendees.RenderControl(writer);
            _wtpRegistrationWorkflow.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-8");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _dtpSendReminder.RenderControl(writer);
            writer.RenderEndTag();              // col-xs-6

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-4");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _cbReminderSent.Visible = _cbReminderSent.Checked;
            _cbReminderSent.RenderControl(writer);
            writer.RenderEndTag();      // col-xs-6

            writer.RenderEndTag();      // row

            writer.RenderEndTag();      // col-md-6
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _ppContact.RenderControl(writer);
            _pnContactPhone.RenderControl(writer);
            _ebContactEmail.RenderControl(writer);

            _cbCost.RenderControl(writer);
            _cbMinimumInitialPayment.RenderControl(writer);
            _cbDefaultPaymentAmount.RenderControl(writer);
            _apAccount.RenderControl(writer);

            writer.RenderEndTag();  // col-md-6
            writer.RenderEndTag();  // row

            _htmlRegistrationInstructions.RenderControl(writer);

            _htmlAdditionalReminderDetails.RenderControl(writer);

            _htmlAdditionalConfirmationDetails.RenderControl(writer);
        }
Exemple #2
0
        /// <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)
        {
            if (CSSClass != string.Empty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "note " + CSSClass);
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "note");
            }

            if (this.NoteId.HasValue)
            {
                writer.AddAttribute("rel", this.NoteId.Value.ToStringSafe());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Edit Mode HTML...
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-noteentry");
            if (NoteId.HasValue || !AddAlwaysVisible)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (DisplayType == NoteDisplayType.Full && UsePersonIcon)
            {
                writer.Write(Person.GetPersonPhotoImageTag(CreatedByPersonId, CreatedByPhotoId, null, CreatedByGender, null, 50, 50));
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "noteentry-control");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlNoteType.RenderControl(writer);
            _tbNote.RenderControl(writer);
            writer.RenderEndTag();

            // The optional create date text box, but only for new notes...
            if (ShowCreateDateInput && !NoteId.HasValue)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "createDate clearfix");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _dtCreateDate.RenderControl(writer);
                writer.RenderEndTag();  // createDate div
            }

            if (DisplayType == NoteDisplayType.Full)
            {
                // Options
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "settings clearfix");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "options pull-left");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                if (ShowAlertCheckBox)
                {
                    _cbAlert.RenderControl(writer);
                }

                if (ShowPrivateCheckBox)
                {
                    _cbPrivate.RenderControl(writer);
                }

                writer.RenderEndTag();

                if (ShowSecurityButton && this.NoteId.HasValue)
                {
                    _sbSecurity.EntityId = this.NoteId.Value;
                    _sbSecurity.Title    = this.Label;
                    _sbSecurity.RenderControl(writer);
                }

                writer.RenderEndTag();  // settings div
            }

            writer.RenderEndTag();  // panel body

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-footer");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _lbSaveNote.Text = "Save " + Label;
            _lbSaveNote.RenderControl(writer);

            if (NoteId.HasValue || !AddAlwaysVisible)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note-cancel btn btn-link btn-xs");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Cancel");
                writer.RenderEndTag();
            }

            writer.RenderEndTag();  // panel-footer div

            writer.RenderEndTag();  // note-entry div

            if (NoteId.HasValue)
            {
                // View Mode HTML...
                writer.AddAttribute(HtmlTextWriterAttribute.Class, ArticleClass);
                writer.RenderBeginTag("article");

                if (DisplayType == NoteDisplayType.Full)
                {
                    if (UsePersonIcon)
                    {
                        writer.Write(Person.GetPersonPhotoImageTag(CreatedByPersonId, CreatedByPhotoId, CreatedByAge, CreatedByGender, null, 50, 50));
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, IconClass);
                        writer.RenderBeginTag(HtmlTextWriterTag.I);
                        writer.RenderEndTag();
                    }
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "details");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                // first, encode the text to ensure html tags get encoded
                string renderedText = Text.EncodeHtml();

                // convert any http, etc text into clickable links (do this before applying Markdown)
                renderedText = renderedText.Linkify();

                // convert any markdown into HTML, and convert into crlf into <br />
                renderedText = renderedText.ConvertMarkdownToHtml(true);

                if (DisplayType == NoteDisplayType.Full)
                {
                    // Heading
                    writer.RenderBeginTag(HtmlTextWriterTag.H5);

                    if (DisplayNoteTypeHeading & this.NoteTypeId.HasValue)
                    {
                        var noteType = NoteTypeCache.Get(this.NoteTypeId.Value);
                        if (noteType != null)
                        {
                            writer.RenderBeginTag(HtmlTextWriterTag.Strong);
                            writer.Write(noteType.Name + " &nbsp; ");
                            writer.RenderEndTag();
                        }
                    }

                    string heading = Caption;
                    if (string.IsNullOrWhiteSpace(Caption))
                    {
                        heading = CreatedByName;
                    }
                    writer.Write(heading.EncodeHtml());
                    if (CreatedDateTime.HasValue)
                    {
                        writer.Write(" ");
                        writer.AddAttribute("class", "date");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedDateTime.Value.ToRelativeDateString(6));
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag();

                    writer.Write(renderedText);
                }
                else
                {
                    writer.Write(renderedText);
                    writer.Write(" - ");
                    if (!string.IsNullOrWhiteSpace(CreatedByName))
                    {
                        writer.AddAttribute("class", "note-author");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedByName);
                        writer.RenderEndTag();
                        writer.Write(" ");
                    }
                    if (CreatedDateTime.HasValue)
                    {
                        writer.AddAttribute("class", "note-created");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedDateTime.Value.ToRelativeDateString(6));
                        writer.RenderEndTag();
                    }
                }

                writer.RenderEndTag();  // Details Div

                if (CanEdit)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "actions rollover-item");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);

                    _lbDeleteNote.RenderControl(writer);

                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-pencil");
                    writer.RenderBeginTag(HtmlTextWriterTag.I);
                    writer.RenderEndTag();
                    writer.RenderEndTag();  // A

                    writer.RenderEndTag();  // actions
                }

                writer.RenderEndTag();  // article
            }

            writer.RenderEndTag();
        }
Exemple #3
0
        /// <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(); // ????
        }
Exemple #4
0
        /// <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)
        {
            if (CSSClass != string.Empty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "note " + CSSClass);
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "note");
            }

            if (this.NoteId.HasValue)
            {
                writer.AddAttribute("rel", this.NoteId.Value.ToStringSafe());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Edit Mode HTML...
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-noteentry");
            if (NoteId.HasValue || !AddAlwaysVisible)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (DisplayType == NoteDisplayType.Full && UsePersonIcon)
            {
                writer.Write(Person.GetPhotoImageTag(CreatedByPhotoId, CreatedByGender, 50, 50));
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "noteentry-control");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlNoteType.RenderControl(writer);
            _tbNote.RenderControl(writer);
            writer.RenderEndTag();

            // The optional create date text box, but only for new notes...
            if (ShowCreateDateInput && !NoteId.HasValue)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "createDate clearfix");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _dtCreateDate.RenderControl(writer);
                writer.RenderEndTag();  // createDate div
            }

            if (DisplayType == NoteDisplayType.Full)
            {
                // Options
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "settings clearfix");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "options pull-left");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                if (ShowAlertCheckBox)
                {
                    _cbAlert.RenderControl(writer);
                }

                if (ShowPrivateCheckBox)
                {
                    _cbPrivate.RenderControl(writer);
                }

                writer.RenderEndTag();

                if (ShowSecurityButton && this.NoteId.HasValue)
                {
                    _sbSecurity.EntityId = this.NoteId.Value;
                    _sbSecurity.Title    = this.Label;
                    _sbSecurity.RenderControl(writer);
                }

                writer.RenderEndTag();  // settings div
            }

            writer.RenderEndTag();  // panel body

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-footer");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _lbSaveNote.Text = "Save " + Label;
            _lbSaveNote.RenderControl(writer);

            if (NoteId.HasValue || !AddAlwaysVisible)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note-cancel btn btn-link btn-xs");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Cancel");
                writer.RenderEndTag();
            }

            writer.RenderEndTag();  // panel-footer div

            writer.RenderEndTag();  // note-entry div

            if (NoteId.HasValue)
            {
                // View Mode HTML...
                writer.AddAttribute(HtmlTextWriterAttribute.Class, ArticleClass);
                writer.RenderBeginTag("article");

                if (DisplayType == NoteDisplayType.Full)
                {
                    if (UsePersonIcon)
                    {
                        writer.Write(Person.GetPhotoImageTag(CreatedByPhotoId, CreatedByGender, 50, 50));
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, IconClass);
                        writer.RenderBeginTag(HtmlTextWriterTag.I);
                        writer.RenderEndTag();
                    }
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "details");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                if (DisplayType == NoteDisplayType.Full)
                {
                    // Heading
                    writer.RenderBeginTag(HtmlTextWriterTag.H5);
                    string heading = Caption;
                    if (string.IsNullOrWhiteSpace(Caption))
                    {
                        heading = CreatedByName;
                    }
                    writer.Write(heading.EncodeHtml());
                    if (CreatedDateTime.HasValue)
                    {
                        writer.Write(" ");
                        writer.AddAttribute("class", "date");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedDateTime.Value.ToRelativeDateString(6));
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag();

                    writer.Write(Text.EncodeHtml().ConvertCrLfToHtmlBr());
                }
                else
                {
                    writer.Write(Text.EncodeHtml().ConvertCrLfToHtmlBr());
                    writer.Write(" - ");
                    if (!string.IsNullOrWhiteSpace(CreatedByName))
                    {
                        writer.AddAttribute("class", "note-author");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedByName);
                        writer.RenderEndTag();
                        writer.Write(" ");
                    }
                    if (CreatedDateTime.HasValue)
                    {
                        writer.AddAttribute("class", "note-created");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                        writer.Write(CreatedDateTime.Value.ToRelativeDateString(6));
                        writer.RenderEndTag();
                    }
                }

                writer.RenderEndTag();  // Details Div

                if (CanEdit)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "actions rollover-item");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);

                    _lbDeleteNote.RenderControl(writer);

                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-pencil");
                    writer.RenderBeginTag(HtmlTextWriterTag.I);
                    writer.RenderEndTag();
                    writer.RenderEndTag();  // A

                    writer.RenderEndTag();  // actions
                }

                writer.RenderEndTag();  // article
            }

            writer.RenderEndTag();
        }