public override string ToHtmlString()
        {
            var mergedHtmlAttributes = _model.htmlAttributes;

            mergedHtmlAttributes.AddOrMergeCssClass("class", "btn");
            if (!string.IsNullOrEmpty(_model.id))
            {
                mergedHtmlAttributes.AddIfNotExist("id", _model.id);
            }

            mergedHtmlAttributes.AddOrMergeCssClass("class", BootstrapHelper.GetClassForButtonSize(_model.size));
            mergedHtmlAttributes.AddOrMergeCssClass("class", BootstrapHelper.GetClassForButtonStyle(_model.style));

            if (_model.buttonBlock)
            {
                mergedHtmlAttributes.AddOrMergeCssClass("class", "btn-block");
            }
            if (_model.isDropDownToggle)
            {
                mergedHtmlAttributes.AddOrMergeCssClass("class", "dropdown-toggle");
                mergedHtmlAttributes.AddIfNotExist("data-toggle", "dropdown");
            }
            if (_model.disabled)
            {
                mergedHtmlAttributes.AddOrMergeCssClass("class", "disabled");
            }

            var input = string.Empty;

            if (_model.iconPrepend != Icons._not_set || _model.iconAppend != Icons._not_set || !string.IsNullOrEmpty(_model.iconPrependCustomClass) || !string.IsNullOrEmpty(_model.iconAppendCustomClass))
            {
                string iPrependString = string.Empty;
                string iAppendString  = string.Empty;
                if (_model.iconPrepend != Icons._not_set)
                {
                    iPrependString = new BootstrapIcon(_model.iconPrepend, _model.iconPrependIsWhite).ToHtmlString();
                }
                if (_model.iconAppend != Icons._not_set)
                {
                    iAppendString = new BootstrapIcon(_model.iconAppend, _model.iconAppendIsWhite).ToHtmlString();
                }
                if (!string.IsNullOrEmpty(_model.iconPrependCustomClass))
                {
                    var i = new TagBuilder("i");
                    i.AddCssClass(_model.iconPrependCustomClass);
                    iPrependString = i.ToString(TagRenderMode.Normal);
                }
                if (!string.IsNullOrEmpty(_model.iconAppendCustomClass))
                {
                    var i = new TagBuilder("i");
                    i.AddCssClass(_model.iconAppendCustomClass);
                    iPrependString = i.ToString(TagRenderMode.Normal);
                }

                string combined =
                    iPrependString +
                    (!string.IsNullOrEmpty(iPrependString) && (!string.IsNullOrEmpty(_model.text) || !string.IsNullOrEmpty(iAppendString)) ? " " : "") +
                    _model.text +
                    (!string.IsNullOrEmpty(iAppendString) && (!string.IsNullOrEmpty(_model.text) || !string.IsNullOrEmpty(iPrependString)) ? " " : "") +
                    iAppendString;

                string holder = Guid.NewGuid().ToString();

                input = GenerateActionLink(holder, mergedHtmlAttributes);
                input = input.Replace(holder, combined);
            }
            else
            {
                input = GenerateActionLink(_model.text, mergedHtmlAttributes);
            }

            return(MvcHtmlString.Create(input).ToString());
        }
        public virtual string ToHtmlString()
        {
            var input = new TagBuilder("button");

            input.Attributes.Add("type", _model.type);
            if (!string.IsNullOrEmpty(_model.name))
            {
                input.Attributes.Add("name", _model.name);
            }
            if (!string.IsNullOrEmpty(_model.id))
            {
                input.Attributes.Add("id", _model.id);
            }
            if (!string.IsNullOrEmpty(_model.value))
            {
                input.Attributes.Add("value", _model.value);
            }
            input.MergeAttributes(_model.htmlAttributes.FormatHtmlAttributes());
            input.AddCssClass(BootstrapHelper.GetClassForButtonSize(_model.size));
            input.AddCssClass(BootstrapHelper.GetClassForButtonStyle(_model.style));
            if (_model.buttonBlock)
            {
                input.AddCssClass("btn-block");
            }
            if (_model.isDropDownToggle)
            {
                input.AddCssClass("dropdown-toggle");
                input.AddOrMergeAttribute("data-toggle", "dropdown");
            }
            if (_model.disabled)
            {
                input.AddCssClass("disabled");
                input.AddOrMergeAttribute("disabled", "");
            }

            if (!string.IsNullOrEmpty(_model.loadingText))
            {
                input.AddOrMergeAttribute("data-loading-text", _model.loadingText);
            }
            input.AddCssClass("btn");

            if (_withCaret)
            {
                if (!string.IsNullOrEmpty(_model.text))
                {
                    _model.text += " ";
                }
                _model.text += "<span class='caret'></span>";
            }

            if (_model.iconPrepend != Icons._not_set || _model.iconAppend != Icons._not_set || !string.IsNullOrEmpty(_model.iconPrependCustomClass) || !string.IsNullOrEmpty(_model.iconAppendCustomClass))
            {
                var iPrependString = string.Empty;
                var iAppendString  = string.Empty;
                if (_model.iconPrepend != Icons._not_set)
                {
                    iPrependString = new BootstrapIcon(_model.iconPrepend, _model.iconPrependIsWhite).ToHtmlString();
                }
                if (_model.iconAppend != Icons._not_set)
                {
                    iAppendString = new BootstrapIcon(_model.iconAppend, _model.iconAppendIsWhite).ToHtmlString();
                }
                if (!string.IsNullOrEmpty(_model.iconPrependCustomClass))
                {
                    var i = new TagBuilder("i");
                    i.AddCssClass(_model.iconPrependCustomClass);
                    iPrependString = i.ToString(TagRenderMode.Normal);
                }
                if (!string.IsNullOrEmpty(_model.iconAppendCustomClass))
                {
                    var i = new TagBuilder("i");
                    i.AddCssClass(_model.iconAppendCustomClass);
                    iAppendString = i.ToString(TagRenderMode.Normal);
                }

                _model.text =
                    iPrependString +
                    (!string.IsNullOrEmpty(iPrependString) && (!string.IsNullOrEmpty(_model.text) || !string.IsNullOrEmpty(iAppendString)) ? " " : "") +
                    _model.text +
                    (!string.IsNullOrEmpty(iAppendString) && (!string.IsNullOrEmpty(_model.text) || !string.IsNullOrEmpty(iPrependString)) ? " " : "") +
                    iAppendString;
            }

            input.InnerHtml = _model.text;
            return(input.ToString());
        }