public static MvcForm ToMvcForm(this HtmlRouteValueDictionary htmlAttributes, string url, FormMethod method, Enctype enctype = Enctype.ApplicationXwwwFormUrlEncoded ) { //if (!htmlAttributes.ContainsKey(HtmlAttribute.Method.ToStringLower())) // htmlAttributes.Set(HtmlAttribute.Method.ToStringLower(), EnumExtensions.ToStringLower(method)); //if (!htmlAttributes.ContainsKey(HtmlAttribute.Enctype.ToStringLower())) // htmlAttributes.Set(HtmlAttribute.Enctype.ToStringLower(), enctype.ToLocalization()); //if (!htmlAttributes.ContainsKey(HtmlAttribute.Action.ToStringLower())) // htmlAttributes.Set(HtmlAttribute.Action.ToStringLower(), url); return(new IncodingHtmlHelper(htmlAttributes.HtmlHelper).BeginMvcForm(url, enctype, method, false, htmlAttributes)); }
public HtmlRouteValueDictionary AsHtmlAttributes(IHtmlHelper htmlHelper, object htmlAttributes = null) { const string dataIncodingKey = "incoding"; var res = new HtmlRouteValueDictionary(AnonymousHelper.ToDictionary(htmlAttributes)); res.HtmlHelper = htmlHelper; var callbacks = merges.Select(@base => @base.AsObject()).ToArray(); if (!res.ContainsKey(dataIncodingKey)) { res.Add(dataIncodingKey, ObjectExtensions.ToJsonString(callbacks)); } else { var newArray = ObjectExtensions.DeserializeFromJson <ExecutableBase.Json[]>(res[dataIncodingKey].ToString()).ToList(); newArray.AddRange(callbacks); res[dataIncodingKey] = ObjectExtensions.ToJsonString(newArray); } return(res); }
public static BeginTag ToBeginForm(this HtmlRouteValueDictionary htmlAttributes, string url, JqueryAjaxOptions.HttpVerbs method = JqueryAjaxOptions.HttpVerbs.Post, Enctype enctype = Enctype.ApplicationXwwwFormUrlEncoded ) { if (!htmlAttributes.ContainsKey(HtmlAttribute.Method.ToStringLower())) { htmlAttributes.Set(HtmlAttribute.Method.ToStringLower(), method.ToStringLower()); } if (!htmlAttributes.ContainsKey(HtmlAttribute.Enctype.ToStringLower())) { htmlAttributes.Set(HtmlAttribute.Enctype.ToStringLower(), enctype.ToLocalization()); } if (!htmlAttributes.ContainsKey(HtmlAttribute.Action.ToStringLower())) { htmlAttributes.Set(HtmlAttribute.Action.ToStringLower(), url); } return(ToBeginTag(htmlAttributes, HtmlTag.Form)); }
public static BeginTag ToBeginTag(this HtmlRouteValueDictionary htmlAttributes, HtmlTag tag) { return(new BeginTag(htmlAttributes.HtmlHelper, tag, htmlAttributes)); }