void Inicializate(object htmlAttributes) { _select2Options = new Select2Options(); _htmlAttributes = new HtmlAttributes(htmlAttributes); SetHtmlAttributesIfNull("style", "width: 100%"); SetHtmlAttributesIfNull("class", "form-control"); SetHtmlAttributesIfNull("name", (_htmlAttributes["name"] ?? _idControle) + (_select2Options.multiple ? "[]" : string.Empty)); }
public static MvcHtmlString Select2(this HtmlHelper htmlHelper, string id, SelectList itens, Select2Options select2Options, object htmlAttributes = null) { return(new Select2Builder(id, htmlAttributes).Config(select2Options).SetSelectList(itens).Montar()); }
public Select2Builder Config(Select2Options select2Options) { _select2Options = select2Options; return(this); }