public static MvcHtmlString ButtonRenkli(this HtmlHelper helper, string id, ButtonType typ, string text, ButtonRenk rnk, string val = "") { TagBuilder tag = new TagBuilder("button"); tag.AddCssClass("btn btn-" + rnk); tag.GenerateId(id); tag.Attributes.Add(new KeyValuePair <string, string>("type", typ.ToString())); tag.Attributes.Add(new KeyValuePair <string, string>("name", id)); tag.Attributes.Add(new KeyValuePair <string, string>("value", val)); tag.SetInnerText(text); return(MvcHtmlString.Create(tag.ToString())); }
public static MvcHtmlString ButtonRenkli(this HtmlHelper helper, string id, ButtonType typ, string text, ButtonRenk rnk) { string html = $"<button class='btn btn-{rnk}' id='{id}' name='{id}' type='{typ}'>{text}</button>"; return(MvcHtmlString.Create(html)); }