Beispiel #1
0
 /// <summary>
 /// Renders the opening HTML tag of the control into the specified <paramref name="writer"/>.
 /// </summary>
 /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
 public override void RenderBeginTag(HtmlTextWriter writer)
 {
     writer.AddAttribute("data-toggle", "tooltip");
     writer.AddAttribute(HtmlTextWriterAttribute.Title, this.Title);
     if (!this.Animate)
     {
         writer.AddAttribute("data-animation", StringHelper.ToLower(this.Animate));
     }
     if (this.Delay > 0)
     {
         writer.AddAttribute("data-delay", this.Delay.ToString());
     }
     if (this.IsHtml)
     {
         writer.AddAttribute("data-html", StringHelper.ToLower(this.IsHtml));
     }
     if (this.Placement != PopoverPositions.Top)
     {
         writer.AddAttribute("data-placement", PopoverPositionsHelper.ToString(this.Placement));
     }
     if (!String.IsNullOrEmpty(this.ContainerSelector))
     {
         writer.AddAttribute("data-container", this.ContainerSelector);
     }
     if (this.Trigger != DEFAULT_TRIGGER)
     {
         writer.AddAttribute("data-trigger", TriggersHelper.ToString(this.Trigger));
     }
     if (this.ViewportSelector != DEFAULT_VIEWPORT || this.ViewportPadding != 0)
     {
         writer.AddAttribute("data-viewport", String.Format("{{ selector: '{0}', padding: {1} }}",
                                                            this.ViewportSelector, this.ViewportPadding));
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Span);
 }
Beispiel #2
0
        /// <summary>
        /// Renders the opening HTML tag of the control into the specified <paramref name="writer"/>.
        /// </summary>
        /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            if (!String.IsNullOrEmpty(this.ModalID))
            {
                Modal modal = (Modal)Modal.FindControlRecursive(this.Page, this.ModalID);

                if (modal != null)
                {
                    this.UseSubmitBehavior = false;
                    writer.AddAttribute("data-toggle", "modal");
                    writer.AddAttribute("data-target", "#" + modal.ClientID);
                }
            }

            if (this.Popover != null)
            {
                if (this.Popover.DismissOnNextClick)
                {
                    throw new InvalidOperationException("Popovers with DismissOnNextClick=\"true\" must be used on HyperLinkButton controls, not Button controls.");
                }
                writer.AddAttribute("data-toggle", "popover");
                writer.AddAttribute("data-container", "body");
                writer.AddAttribute("data-content", this.Popover.Text);
                if (this.Popover.Position != PopoverPositions.Right)
                {
                    writer.AddAttribute("data-placement", PopoverPositionsHelper.ToString(this.Popover.Position));
                }
                if (this.Popover.Trigger != Popover.DEFAULT_TRIGGER)
                {
                    writer.AddAttribute("data-trigger", TriggersHelper.ToString(this.Popover.Trigger));
                }
                if (!String.IsNullOrEmpty(this.Popover.Title))
                {
                    writer.AddAttribute("title", this.Popover.Title);
                }
            }

            if (!this.UseSubmitBehavior)
            {
                this.OnClientClick = String.Format("return {0};", StringHelper.ToLower(this.Popover != null));
            }

            this.CssClass = this.BuildCss();
            this.Attributes.Add("type", "button");
            this.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Button);
        }
        /// <summary>
        /// Renders the opening HTML tag of the control into the specified <paramref name="writer"/>.
        /// </summary>
        /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            if (!String.IsNullOrEmpty(this.ModalID))
            {
                Modal modal = (Modal)Modal.FindControlRecursive(this.Page, this.ModalID);

                if (modal != null)
                {
                    writer.AddAttribute("data-toggle", "modal");
                    writer.AddAttribute("data-target", "#" + modal.ClientID);
                }
            }

            if (this.Popover != null)
            {
                writer.AddAttribute("data-toggle", "popover");
                writer.AddAttribute("data-container", "body");
                writer.AddAttribute("data-content", this.Popover.Text);
                if (this.Popover.Position != PopoverPositions.Right)
                {
                    writer.AddAttribute("data-placement", PopoverPositionsHelper.ToString(this.Popover.Position));
                }
                if (this.Popover.Trigger != Popover.DEFAULT_TRIGGER)
                {
                    writer.AddAttribute("data-trigger", TriggersHelper.ToString(this.Popover.Trigger));
                }

                if (this.Popover.DismissOnNextClick)
                {
                    writer.AddAttribute("tabindex", "0");
                    writer.AddAttribute("data-trigger", "focus");
                }
                if (!String.IsNullOrEmpty(this.Popover.Title))
                {
                    writer.AddAttribute("title", this.Popover.Title);
                }
            }

            this.CssClass = this.BuildCss();
            this.Attributes.Add("role", "button");
            this.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.A);
        }