Beispiel #1
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));
        }
Beispiel #2
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));
        }