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 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); }