public override HelperResult GetControlHtml() { var link = new TagBuilder(_isSubmit ? "button" : "a"); link.AddCssClass("btn"); if (!string.IsNullOrEmpty(_customType)) { link.AddCssClass(_customType); } else { link.AddCssClass("btn-" + _type.ToString()); } if (_size != ActionButtonSize.Default) { link.AddCssClass("btn-" + _size.ToString()); } if (!_isSubmit) { string url = _url; if (string.IsNullOrEmpty(url) && (!string.IsNullOrEmpty(_action) || !string.IsNullOrEmpty(_controller))) { url = new UrlHelper(HtmlHelper.ViewContext.RequestContext).Action(_action, _controller, _route); } if (!string.IsNullOrEmpty(url)) { link.MergeAttribute("href", url); } } else { link.MergeAttribute("type", "submit"); } if (!string.IsNullOrEmpty(_onClick)) { link.MergeAttribute("onclick", _onClick); } object id; if (HtmlAttributes.TryGetValue("id", out id)) { link.MergeAttribute("id", (string)id); } link.InnerHtml = _text; return(new HelperResult(writer => writer.Write(link.ToString()))); }