/// <summary>
        /// This renders out the form for us
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="formAction"></param>
        /// <param name="method"></param>
        /// <param name="htmlAttributes"></param>
        /// <param name="surfaceController"></param>
        /// <param name="surfaceAction"></param>
        /// <param name="area"></param>		
        /// <param name="additionalRouteVals"></param>
        /// <returns></returns>
        /// <remarks>
        /// This code is pretty much the same as the underlying MVC code that writes out the form
        /// </remarks>
        private static MvcForm RenderForm(this IHtmlHelper htmlHelper,
                                          string formAction,
                                          FormMethod method,
                                          IDictionary<string, object> htmlAttributes,
                                          string surfaceController,
                                          string surfaceAction,
                                          string area,
                                          object additionalRouteVals = null)
        {
            if (htmlAttributes == null)
            {
                htmlAttributes = new Dictionary<string, object>();
            }
            //ensure that the multipart/form-data is added to the html attributes
            if (htmlAttributes.ContainsKey("enctype") == false)
            {
                htmlAttributes.Add("enctype", "multipart/form-data");
            }

            var tagBuilder = new TagBuilder("form");
            tagBuilder.MergeAttributes(htmlAttributes);
            // action is implicitly generated, so htmlAttributes take precedence.
            tagBuilder.MergeAttribute("action", formAction);
            // method is an explicit parameter, so it takes precedence over the htmlAttributes.
            tagBuilder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true);

            tagBuilder.TagRenderMode = TagRenderMode.StartTag;
            tagBuilder.WriteTo(htmlHelper.ViewContext.Writer, new HtmlEncoder());

            //new UmbracoForm:
            var theForm = new UmbracoForm(htmlHelper.UrlEncoder, htmlHelper.ViewContext, surfaceController, surfaceAction, area, additionalRouteVals);

            return theForm;
        }
 public static IDisposable FormRoute(this HtmlHelper html, string routeName, FormMethod method, RouteValueDictionary valuesDictionary) {
     VirtualPathData virtualPath = RouteTable.Routes.GetVirtualPath(html.ViewContext, routeName, valuesDictionary);
     string formAction = (virtualPath == null) ? null : virtualPath.VirtualPath;
     SimpleForm form = new SimpleForm(html.ViewContext.HttpContext, formAction, method, null);
     form.WriteStartTag();
     return form;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Writes an opening form tag to the response. When the user submits the form,
        /// the request will be processed by the route target.
        /// </summary>
        /// <param name="htmlHelper">The HTML helper.</param>
        /// <param name="routeName">The name of the route to use to obtain the form-post URL.</param>
        /// <param name="method">The HTTP method for processing the form, either GET or POST.</param>
        /// <param name="routeValues">An object that contains the parameters for evaluatedValueString route.</param>
        /// <param name="htmlAttributes">The HTTP method for processing the form, either GET or POST.</param>
        /// <returns>An opening form tag.</returns>
        public static IDisposable BeginRouteForm(this HtmlHelper htmlHelper, string routeName, FormMethod method = FormMethod.Post, object routeValues = null, object htmlAttributes = null)
        {
            var routeDictionary = htmlHelper.AutomaticRouteValuesDictionary(routeValues);
            var attrDictionary = htmlHelper.AutomaticHtmlAttributes(htmlAttributes);

            return BootstrapHelperConfiguration.HtmlRenderer.BeginRouteForm(htmlHelper, routeName, method, routeDictionary, attrDictionary);
        }
Exemplo n.º 4
0
 public Form(Task<ActionResult> taskResult)
     : base(null)
 {
     this._taskResult = taskResult;
     this._formMethod = System.Web.Mvc.FormMethod.Post;
     _actionTypePassed = ActionTypePassed.HtmlTaskResult;
 }
Exemplo n.º 5
0
 public Form(ActionResult result)
     : base(null)
 {
     this._result = result;
     this._formMethod = System.Web.Mvc.FormMethod.Post;
     _actionTypePassed = ActionTypePassed.HtmlActionResult;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Sets configuration values for the rendered HTML form.
        /// </summary>
        /// <param name="actionName">The name of the target action.</param>
        /// <param name="controllerName">The name of the target controller.</param>
        /// <param name="routeValues">The route values for the target action.</param>
        /// <param name="formMethod">The method used to submit the form.</param>
        /// <param name="cssClass">The element class.</param>
        /// <param name="cssStyle">The element style.</param>
        /// <returns>The configured <see cref="System.Web.Mvc.Html.MvcForm"/> instance.</returns>
        public MvcForm With(
            string actionName = null, 
            string controllerName = null, 
            object routeValues = null, 
            FormMethod formMethod = FormMethod.Post, 
            string cssClass = null, 
            string cssStyle = null)
        {
            base.With(cssClass, cssStyle);

            if (controllerName.IsNullOrEmpty())
            {
                controllerName = this.HtmlHelper.InnerHelper.ViewContext.RouteData.Values["Controller"] as string;
            }

            if (actionName.IsNullOrEmpty())
            {
                actionName = this.HtmlHelper.InnerHelper.ViewContext.RouteData.Values["Action"] as string;
            }

            var htmlAttributes = this.HtmlAttributes;
            var safeRouteValues = new RouteValueDictionary(routeValues);

            MvcForm form;

            form = this.HtmlHelper
                       .InnerHelper
                            .BeginForm(actionName, controllerName, safeRouteValues, formMethod, htmlAttributes);
            
            return form;
        }
Exemplo n.º 7
0
 public Form(string action)
     : base(null)
 {
     this._action = action;
     this._formMethod = System.Web.Mvc.FormMethod.Post;
     _actionTypePassed = ActionTypePassed.HtmlRegular;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Sets action attribute to a form element by using controller and an action method
 /// </summary>
 /// <param name="action"></param>
 /// <param name="controller"></param>
 public Form(string action, string controller)
     : base(null)
 {
     this._action = action;
     this._controller = controller;
     this._formMethod = System.Web.Mvc.FormMethod.Post;
 }
Exemplo n.º 9
0
        public jQueryForm(ViewContext context, string action, FormMethod method, jQueryAjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
            : base("form", TagRenderMode.StartTag)
        {


            MergeAttributes(htmlAttributes);
            Method = method;
            Action = action;
            ViewContext = context;
            OriginalFormContext = context.FormContext;
            context.FormContext = new FormContext();
            AjaxOptions = ajaxOptions ?? new jQueryAjaxOptions();

            if (AjaxOptions != null && AjaxOptions.Metadata)
            {
                AddClass("jquery-ajax-form");
                Attributes.Merge("data-jquery-ajax", AjaxOptions.ToJson());
            }

            if (string.IsNullOrWhiteSpace(Id))
            {
                Attributes.Merge("id", string.Format("form{0}", DateTime.UtcNow.Ticks));
            }
            //context.Writer.Write(f.Html(context));
        }
Exemplo n.º 10
0
        public FormContainer(HtmlTextWriter htmlTextWriter,
            string url ,
            BootstrapFormType formType = BootstrapFormType.Horizontal,
            FormMethod method = FormMethod.Post,
            object htmlAttributes = null)
        {
            this.textWriter = htmlTextWriter;
            this.formType = formType;

           // textWriter.AddAttribute("method", method.ToString());

            //textWriter.AddAttribute("action", url ) ;
            var htmlAttributesCollection = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);

            switch (this.formType)
            {
                case BootstrapFormType.Horizontal: htmlAttributesCollection.Merge("class", "form-horizontal"); break;
                case BootstrapFormType.Vertical: htmlAttributesCollection.Merge("class", "form-vertical"); break;
                case BootstrapFormType.Inline: htmlAttributesCollection.Merge("class", "form-inline"); break;
            }

            foreach (var htmlAttribute in htmlAttributesCollection)
            {
                textWriter.AddAttribute(htmlAttribute.Key, htmlAttribute.Value.ToString());
            }
            textWriter.RenderBeginTag(HtmlTextWriterTag.Form);
            
        }
Exemplo n.º 11
0
 /// <summary>
 /// Writes an opening &lt;form&gt; tag to the response. When the user submits the form,
 /// the request will be processed by an action method.
 /// </summary>
 /// <param name="htmlHelper">The HTML helper instance that this method extends.</param>
 /// <param name="formClass">CSS class for <c>form</c> element</param>
 /// <param name="method">The HTTP method for processing the form, either GET or POST.</param>
 /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param>
 /// <returns>An opening <form> tag</returns>
 public static CarcassMvcForm CarcassBeginForm(this HtmlHelper htmlHelper,
     string formClass = CarcassMvcSettings.BootsrapFormClassHorisontal, 
     FormMethod method = FormMethod.Post,
     object htmlAttributes = null)
 {
     var rawUrl = htmlHelper.ViewContext.HttpContext.Request.RawUrl;
     return CarcassBeginFormImpl(htmlHelper, rawUrl, formClass, method, (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
Exemplo n.º 12
0
 public static MvcForm BeginForm( this HtmlHelper htmlHelper,
                                  String actionName,
                                  String controllerName,
                                  Hash values,
                                  FormMethod method )
 {
     return htmlHelper.BeginForm(actionName, controllerName, HashHelper.ToRouteValueDictionary( values ), method);
 }
Exemplo n.º 13
0
 private void Init(HtmlHelper html, string actionName = null, string controllerName = null, object routeValues = null,
                   FormMethod method = FormMethod.Post, object htmlAttrs = null, FormType? formType = null)
 {
     var attrs = new HtmlAttributes(htmlAttrs);
     if (formType != null) attrs["class"] += "form-" + formType.ToString().ToLower();
     if (html == null) return;
     _form = html.BeginForm(actionName, controllerName, new RouteValueDictionary(routeValues), method, attrs.ToDictionary());
 }
Exemplo n.º 14
0
 public static MvcForm BeginForm( this HtmlHelper htmlHelper,
                                  String actionName,
                                  String controllerName,
                                  FormMethod method,
                                  Hash htmlAttributes )
 {
     return htmlHelper.BeginForm(actionName, controllerName, method, HashHelper.ToStringKeyDictinary( htmlAttributes ));
 }
Exemplo n.º 15
0
 public static MvcForm BeginForm(
     [NotNull] this IHtmlHelper htmlHelper,
     FormMethod method,
     object htmlAttributes)
 {
     return htmlHelper.BeginForm(actionName: null, controllerName: null, routeValues: null,
                                 method: method, htmlAttributes: htmlAttributes);
 }
Exemplo n.º 16
0
        public static MvcHtmlString Button(this HtmlHelper helper, 
            string text, string urlAction, FormMethod method, object htmlAttributes)
        {
            var tagBuilder = new TagBuilder("input");
            FillWithAttributes(tagBuilder, new { type = "submit", formaction = urlAction, formmethod = method.ToString(), value = text });
            FillWithAttributes(tagBuilder, htmlAttributes);

            return new MvcHtmlString(tagBuilder.ToString());
        }
Exemplo n.º 17
0
        public static MsAspMvc.MvcForm BeginAngularForm(this HtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method, object htmlAttributes)
        {
            RouteValueDictionary routeValues = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
            if (!routeValues.ContainsKey("name"))
                routeValues.Add("name", "form");

            htmlHelper.ViewData.Add("formName", routeValues["name"]);
            return MsAspMvc.FormExtensions.BeginForm(htmlHelper, actionName, controllerName, method, routeValues);
        }
Exemplo n.º 18
0
 public static MvcForm BeginForm(
     [NotNull] this IHtmlHelper htmlHelper,
     string actionName,
     string controllerName,
     FormMethod method)
 {
     return htmlHelper.BeginForm(actionName, controllerName, routeValues: null,
                                 method: method, htmlAttributes: null);
 }
 public static IDisposable MyBeginForm(this HtmlHelper html, string action, string controller, FormMethod method)
 {
     var routeValues = new RouteValueDictionary();
     var query = html.ViewContext.HttpContext.Request.QueryString;
     foreach (string key in query)
     {
         routeValues[key] = query[key];
     }
     return html.BeginForm(action, controller, routeValues, FormMethod.Get);
 }
Exemplo n.º 20
0
        public Form(EventData eventData)
            : base(null)
        {
            this._action = eventData.Action;
            this._controller = eventData.Controller;
            this._routeValues = eventData.RouteValues;
            this._formMethod = System.Web.Mvc.FormMethod.Post;

            _actionTypePassed = ActionTypePassed.HtmlRegular;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Renders a &lt;form&gt; start tag to the response. When the user submits the form, the
        /// current action will process the request.
        /// </summary>
        /// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
        /// <param name="method">The HTTP method for processing the form, either GET or POST.</param>
        /// <returns>
        /// An <see cref="MvcForm"/> instance which renders the &lt;/form&gt; end tag when disposed.
        /// </returns>
        /// <remarks>
        /// In this context, "renders" means the method writes its output using <see cref="ViewContext.Writer"/>.
        /// </remarks>
        public static MvcForm BeginForm(this IHtmlHelper htmlHelper, FormMethod method)
        {
            if (htmlHelper == null)
            {
                throw new ArgumentNullException(nameof(htmlHelper));
            }

            return htmlHelper.BeginForm(actionName: null, controllerName: null, routeValues: null,
                                        method: method, htmlAttributes: null);
        }
Exemplo n.º 22
0
 /// <summary>
 /// Invokes the private static "FormHelper" method of the <see cref="T:System.Web.Mvc.Html.FormExtensions" /> class via reflection.
 /// </summary>
 /// <param name="htmlHelper">The HTML helper.</param>
 /// <param name="formAction">The form action.</param>
 /// <param name="method">The method.</param>
 /// <param name="htmlAttributes">The HTML attributes.</param>
 /// <returns></returns>
 public static MvcForm FormHelper(HtmlHelper htmlHelper,
                                  string formAction,
                                  FormMethod method,
                                  IDictionary<string, object> htmlAttributes)
 {
     return (MvcForm) typeof (FormExtensions).InvokeMember("FormHelper",
                                                           BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod,
                                                           null,
                                                           null,
                                                           new object[] {htmlHelper, formAction, method, htmlAttributes});
 }
Exemplo n.º 23
0
        public static MvcForm PantherForm(this IHtmlHelper htmlHelper, string Path, FormMethod method = FormMethod.Post, IDictionary<string, object> htmlAttributes = null)
        {
            
            TagBuilder builder = new TagBuilder("form");
            builder.MergeAttributes(htmlAttributes);
            builder.MergeAttribute("action", Path);
            builder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true);

            htmlHelper.ViewContext.Writer.Write(builder.ToString(TagRenderMode.StartTag));

            return new MvcForm(htmlHelper.ViewContext);
        }
Exemplo n.º 24
0
 public override MvcHtmlString Form(String url, Object routeValues, FormMethod formMethod, Object htmlAttribute, String innerHtml)
 {
     StringBuilder stringBuilder = new StringBuilder();
     stringBuilder.Append("<form ");
     stringBuilder.Append(TagHelper.PackHtmlAttrbute(htmlAttribute));
     stringBuilder.Append(String.Concat(TagHelper.PackFormMethod(formMethod), " "));
     stringBuilder.Append(TagHelper.PackAction(url, routeValues));
     stringBuilder.AppendLine(">");
     stringBuilder.AppendLine(innerHtml);
     stringBuilder.Append("</form>");
     return MvcHtmlString.Create(stringBuilder.ToString());
 }
Exemplo n.º 25
0
 public static MvcForm BeginUmbracoForm(this IHtmlHelper html, 
     UmbracoContext umbCtx,
     string action, 
     string controllerName, 
     string area = null,
     object additionalRouteVals = null,
     IDictionary<string, object> htmlAttributes = null,
     FormMethod method = FormMethod.Post)
 {
     var formAction = umbCtx.OriginalRequestUri.AbsolutePath;
     return html.RenderForm(formAction, method, htmlAttributes, controllerName, action, area, additionalRouteVals);
 }
Exemplo n.º 26
0
 /// <summary>
 /// Creates the HTML for a form tag.
 /// </summary>
 /// <param name="action">The URL the form submits to</param>
 /// <param name="method">The HTTP method the form submits with</param>
 /// <param name="htmlAttributes">Any HTML attributes that should be applied to the form; specified as an anonymous object</param>
 /// <param name="encType">The encoding type the form uses</param>
 /// <returns>The HTML for the form</returns>
 public static IHtmlString BuildFormTag(string action, FormMethod method, HtmlAttributes htmlAttributes = null, EncType? encType = null)
 {
     var tagBuilder = new TagBuilder("form");
     if (htmlAttributes != null)
         tagBuilder.MergeAttributes(htmlAttributes.Attributes);
     tagBuilder.MergeAttribute("action", action);
     tagBuilder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true);
     if (encType.HasValue)
     {
         tagBuilder.MergeAttribute("enctype", encType.Humanize());
     }
     return new HtmlString(tagBuilder.ToString(TagRenderMode.StartTag));
 }
        public static MvcForm BeginForm(this HtmlHelper html,
		                                string controllerName = null,
		                                string actionName = null,
		                                object routeValues = null,
		                                FormMethod method = FormMethod.Post,
		                                string cssClass = "",
		                                object htmlAttributes = null)
        {
            var routeDictionary         = new RouteValueDictionary(routeValues);
            var htmlAttibutesDictionary = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);

            return html.BeginForm(controllerName: controllerName, actionName: actionName, routeValues: routeDictionary,
                                  method: method, cssClass: cssClass, htmlAttributes: htmlAttibutesDictionary);
        }
Exemplo n.º 28
0
        static BootstrapForm StyledForm(this HtmlHelper htmlHelper, string formAction, FormMethod method, IDictionary<string, object> htmlAttributes, string cssClass)
        {
            TagBuilder builder = new TagBuilder("fieldset");
            builder.AddCssClass(cssClass);
            builder.MergeAttributes<string, object>(htmlAttributes);
            builder.MergeAttribute("action", formAction);
            builder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true);
            htmlHelper.ViewContext.Writer.Write(builder.ToString(TagRenderMode.StartTag));
            
            TagBuilder fieldset = new TagBuilder("fieldset");
            htmlHelper.ViewContext.Writer.Write(fieldset.ToString(TagRenderMode.StartTag));

            return new BootstrapForm(htmlHelper.ViewContext);
        }
Exemplo n.º 29
0
        private static MvcForm FormHelper(this HtmlHelper htmlHelper, string formAction, FormMethod method,
                                          IDictionary<string, object> htmlAttributes)
        {
            var tagBuilder = new TagBuilder("form");
            tagBuilder.MergeAttributes(htmlAttributes);
            // action is implicitly generated, so htmlAttributes take precedence.
            tagBuilder.MergeAttribute("action", formAction);
            // method is an explicit parameter, so it takes precedence over the htmlAttributes.
            tagBuilder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true);

            htmlHelper.ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag));
            var theForm = new MvcForm(htmlHelper.ViewContext);

            return theForm;
        }
Exemplo n.º 30
0
        public MvcForm BeginForm(string actionName = "", string controllerName = "", object routeValues = null, FormMethod method = FormMethod.Get, object htmlAttributes = null)
        {
            var qs = UrlHelper.GenerateQueryString (routeValues);
            if (qs.Length > 0)
                qs = "?" + qs;

            var form = String.Format ("<form action=\"{0}:{1}{2}{3}\" method=\"{4}\"{5}>",
                ViewBase.UrlProtocol,
                String.IsNullOrEmpty (controllerName) ? String.Empty : controllerName + "/",
                actionName,
                qs,
                method == FormMethod.Post ? "post" : "get",
                GenerateHtmlAttributes(htmlAttributes));
            _writer.Write (form);
            return new MvcForm (_writer, "form");
        }
Exemplo n.º 31
0
 /// <summary>
 /// Renders a form suitable for BForms fields
 /// </summary>
 public static BsMvcForm BsBeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, object routeValues, FormMethod method, object htmlAttributes, BsTheme theme)
 {
     return(BsBeginForm(htmlHelper, actionName, controllerName, new RouteValueDictionary(routeValues), method, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes), theme));
 }
Exemplo n.º 32
0
 public ModalFormHelpers(string actionName, string controllerName, object routeValues, FormMethod method, object htmlAttributes)
 {
     ActionName     = actionName;
     ControllerName = controllerName;
     RouteValues    = routeValues;
     Method         = method;
     HtmlAttributes = htmlAttributes;
 }
Exemplo n.º 33
0
 public static MvcForm BeginForm(this HtmlHelper htmlHelper, ActionResult result, FormMethod formMethod, object htmlAttributes)
 {
     return(BeginForm(htmlHelper, result, formMethod, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)));
 }
Exemplo n.º 34
0
 public static MvcForm ListBeginForm(this IHtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method, object htmlAttributes)
 {
     return(htmlHelper.BeginForm(
                actionName,
                controllerName,
                new
     {
         descending = htmlHelper.GetDescendingValue(),
         filter = htmlHelper.GetFilterValue(),
         page = htmlHelper.GetPageValue(),
         sort = htmlHelper.GetSortValue()
     },
                method,
                false, // new antiforgery parameter.
                htmlAttributes));
 }
Exemplo n.º 35
0
 public static MvcForm BeginForm(this HtmlHelper htmlHelper, ActionResult result, FormMethod formMethod, object htmlAttributes)
 {
     return(BeginForm(htmlHelper, result, formMethod, new RouteValueDictionary(htmlAttributes)));
 }
Exemplo n.º 36
0
        public static MvcForm BeginForm(this HtmlHelper htmlHelper, ActionResult result, FormMethod formMethod, IDictionary <string, object> htmlAttributes)
        {
            var callInfo = (IT4MVCActionResult)result;

            return(htmlHelper.BeginForm(callInfo.Action, callInfo.Controller, callInfo.RouteValues, formMethod, htmlAttributes));
        }
Exemplo n.º 37
0
 /// <summary>
 /// Renders a form suitable for BForms fields
 /// </summary>
 public static BsMvcForm BsBeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, object routeValues, FormMethod method)
 {
     return(BsBeginForm(htmlHelper, actionName, controllerName, new RouteValueDictionary(routeValues), method, new RouteValueDictionary(), BsTheme.Default));
 }
Exemplo n.º 38
0
 public FormContainer BeginForm(string actionName, string controllerName, FormMethod method, object htmlAttributes, BootstrapFormType formType = BootstrapFormType.Horizontal)
 {
     return(BeginForm(actionName, controllerName, new RouteValueDictionary(), method, htmlAttributes, formType));
 }
Exemplo n.º 39
0
        public FormContainer BeginForm(string actionName, string controllerName, RouteValueDictionary routeValues, FormMethod method, object htmlAttributes, BootstrapFormType formType = BootstrapFormType.Horizontal)
        {
            var formAction = UrlHelper.GenerateUrl(null, actionName, controllerName, routeValues, this.helper.RouteCollection, this.helper.ViewContext.RequestContext, true);
            var textWriter = new HtmlTextWriter(helper.ViewContext.Writer);
            var fc         = new FormContainer(textWriter, formAction, method: method, htmlAttributes: htmlAttributes, formType: formType);

            return(fc);
        }
Exemplo n.º 40
0
        /// <summary>
        /// Renders a form suitable for BForms fields
        /// </summary>
        public static BsMvcForm BsBeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues, FormMethod method, IDictionary <string, object> htmlAttributes, BsTheme theme)
        {
            var form = htmlHelper.BeginForm(actionName, controllerName, routeValues, method, htmlAttributes);

            var tag = new TagBuilder("div");

            tag.AddCssClass("row");
            tag.AddCssClass("form_container");
            tag.AddCssClass("loading");
            tag.AddCssClass(theme.GetDescription());

            var myForm = new BsMvcForm(htmlHelper.ViewContext, form, tag.ToString(TagRenderMode.StartTag), tag.ToString(TagRenderMode.EndTag));

            //htmlHelper.ViewContext.Writer.Write("<span>Test</span>");

            return(myForm);
        }
Exemplo n.º 41
0
 /// <summary>
 /// Set the 'formmethod' attribute.
 /// </summary>
 /// <param name="value">The value of the attribute.</param>
 public T Method(FormMethod value)
 {
     Attr(HtmlAttribute.FormMethod, value.ToString().ToLower());
     return((T)this);
 }
Exemplo n.º 42
0
 public static MvcForm BeginActionForm(this HtmlHelper htmlHelper, FormMethod formMethod, object htmlAttributes)
 {
     return(htmlHelper.BeginForm(Guid.NewGuid().ToString(),
                                 htmlHelper.ViewContext.RouteData.GetRequiredString("controller"), formMethod, htmlAttributes));
 }
Exemplo n.º 43
0
 public static MvcForm BeginForm(this HtmlHelper htmlHelper, ActionResult result, FormMethod formMethod)
 {
     return(htmlHelper.BeginForm(result, formMethod, null));
 }
Exemplo n.º 44
0
 public ModalFormHelpers(string actionName, string controllerName, FormMethod method)
 {
     ActionName     = actionName;
     ControllerName = controllerName;
     Method         = method;
 }
Exemplo n.º 45
0
 /// <summary>
 /// Renders a form suitable for BForms fields
 /// </summary>
 public static BsMvcForm BsBeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method, IDictionary <string, object> htmlAttributes, BsTheme theme)
 {
     return(BsBeginForm(htmlHelper, actionName, controllerName, new RouteValueDictionary(), method, htmlAttributes, theme));
 }
Exemplo n.º 46
0
 public static MvcForm BeginForm(this HtmlHelper htmlHelper, string formId, FormMethod method)
 {
     return(htmlHelper.BeginForm(null, null, method, new { id = formId }));
 }
Exemplo n.º 47
0
 /// <summary>
 /// Renders a form suitable for BForms fields
 /// </summary>
 public static BsMvcForm BsBeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues, FormMethod method, BsTheme theme)
 {
     return(BsBeginForm(htmlHelper, actionName, controllerName, routeValues, method, new RouteValueDictionary(), theme));
 }