using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace System.Web.Mvc { public static class FormExtensions { public static System.Web.Mvc.Html.MvcForm BeginForm(this HtmlHelper htmlHelper, string formID = null, string formName = null) { string id = string.IsNullOrEmpty(formID) ? "form_" + Guid.NewGuid().ToString().Substring(0, 6) : formID; return System.Web.Mvc.Html.FormExtensions.BeginForm(htmlHelper, null, null, FormMethod.Post, new Dictionary { { "id", id }, { "name", string.IsNullOrEmpty(formName) ? id : formName } }); } } }