Beispiel #1
0
        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()));
        }
Beispiel #2
0
        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));
        }