Exemplo n.º 1
0
        public static MvcHtmlString Button2(this HtmlHelper helper, ButtonOptions options)
        {
            var builder = new TagBuilder("button");

            builder.Attributes.Add(new KeyValuePair <string, string>("name", options.Name));
            builder.GenerateId(options.Id);
            builder.SetInnerText(options.Text);
            builder.AddCssClass(options.Class);
            builder.Attributes.Add(new KeyValuePair <string, string>("type", options.Type.ToString()));
            return(MvcHtmlString.Create(builder.ToString()));
        }
Exemplo n.º 2
0
 public static MvcHtmlString Button1(this HtmlHelper helper, ButtonOptions options)
 {
     try
     {
         var button = string.Format("<button id='{0}' name='{1}' type='{2}' class='{3}'>{4}</button>", options.Id, options.Name, options.Type.ToString(), options.Class, options.Text);
         return(MvcHtmlString.Create(button));
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }