Example #1
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (ButtonIcon != FontAwesomeIcons.NotSet)
            {
                string cssToAdd = "";
                if (ToolBarButton || !String.IsNullOrWhiteSpace(this.Text))
                {
                    cssToAdd += " marginright5";
                }

                writer.Write("<i class=\"{0} {1} {2}\"></i>", ButtonIconType.GetStringValueClass(), ButtonIcon.GetStringValueClass(), cssToAdd);

                if (ButtonType == ButtonType.QuickButton)
                {
                    writer.Write(String.Format("<p>{0}</p>", this.Text));
                }
                else
                {
                    writer.Write(this.Text);
                }
            }
            else
            {
                writer.Write(this.Text);
            }

            if (!string.IsNullOrWhiteSpace(NotificationValue))
            {
                writer.Write("<span class='notification orange'>{0}</span>", NotificationValue);
            }

            base.RenderContents(writer);
        }
Example #2
0
        /// <summary>
        /// Returns the jquery css class associated with the passed icon
        /// </summary>
        /// <param name="icon"></param>
        /// <returns>Class name or null (not an empty string) string for icon=Custom</returns>
        /// <exception cref="ArgumentOutOfRangeException">icon parameter cannot be None or Custom</exception>
        private static string GetIcon(ButtonIconType icon)
        {
            string str;

            switch (icon)
            {
            case ButtonIconType.None:
            case ButtonIconType.Custom:
                throw new ArgumentOutOfRangeException("icon", icon, "Cannot be None or Custom");

            default:
                str = string.Format("ui-icon-{0}", icon.ToString().ToLower().Replace('_', '-'));
                break;
            }
            return(str);
        }