Example #1
0
        protected virtual string BeginForm <TModel>(HtmlHelper htmlHelper, RoboUIFormResult <TModel> roboForm, string formId) where TModel : class
        {
            if (roboForm.Layout == RoboUIFormLayout.Wizard)
            {
                roboForm.FormActionUrl = null;
            }

            string formActionUrl = string.IsNullOrEmpty(roboForm.FormActionUrl)
                ? htmlHelper.ViewContext.HttpContext.Request.RawUrl
                : roboForm.FormActionUrl;

            var form = new FluentTagBuilder("form", TagRenderMode.StartTag)
                       .MergeAttribute("action", formActionUrl)
                       .MergeAttribute("id", formId)
                       .MergeAttribute("method", roboForm.FormMethod.ToString().ToLowerInvariant());

            if (roboForm.Layout == RoboUIFormLayout.Tab)
            {
                form = form.MergeAttribute("data-ajax-begin", formId.Replace("-", "_") + "_ValidateTabs");
            }

            if (!roboForm.AjaxEnabled)
            {
                form = form.MergeAttribute("enctype", "multipart/form-data");
            }
            else
            {
                form = form.MergeAttribute("data-ajax", "true");
            }

            form = form.MergeAttribute("method", roboForm.FormMethod.ToString().ToLowerInvariant());
            form = form.MergeAttributes(roboForm.HtmlAttributes);

            return(form.ToString());
        }
Example #2
0
 public virtual string RenderComplexAttribute <TModel>(HtmlHelper htmlHelper, RoboUIFormResult <TModel> roboForm, RoboComplexAttribute roboAttribute) where TModel : class
 {
     throw new NotImplementedException();
 }
Example #3
0
        public virtual string RenderControl <TModel>(HtmlHelper htmlHelper, RoboUIFormResult <TModel> roboForm, RoboControlAttribute roboAttribute) where TModel : class
        {
            if (roboAttribute is RoboIconFontPickerAttribute)
            {
                return(RenderIconFontPickerAttribute(htmlHelper, roboForm, roboAttribute as RoboIconFontPickerAttribute));
            }

            if (roboAttribute is RoboAutoCompleteAttribute)
            {
                return(RenderAutoCompleteAttribute(htmlHelper, roboForm, roboAttribute as RoboAutoCompleteAttribute));
            }

            if (roboAttribute is RoboButtonAttribute)
            {
                return(RenderButtonAttribute(htmlHelper, roboForm, roboAttribute as RoboButtonAttribute));
            }

            if (roboAttribute is RoboCaptchaAttribute)
            {
                return(RenderCaptchaAttribute(htmlHelper, roboForm, roboAttribute as RoboCaptchaAttribute));
            }

            if (roboAttribute is RoboCascadingCheckBoxListAttribute)
            {
                return(RenderCascadingCheckBoxListAttribute(htmlHelper, roboForm, roboAttribute as RoboCascadingCheckBoxListAttribute));
            }

            if (roboAttribute is RoboCascadingDropDownAttribute)
            {
                return(RenderCascadingDropDownAttribute(htmlHelper, roboForm, roboAttribute as RoboCascadingDropDownAttribute));
            }

            if (roboAttribute is RoboColorPickerAttribute)
            {
                return(RenderColorPickerAttribute(htmlHelper, roboForm, roboAttribute as RoboColorPickerAttribute));
            }

            if (roboAttribute is RoboChoiceAttribute)
            {
                return(RenderChoiceAttribute(htmlHelper, roboForm, roboAttribute as RoboChoiceAttribute));
            }

            if (roboAttribute is RoboComplexAttribute)
            {
                return(RenderComplexAttribute(htmlHelper, roboForm, roboAttribute as RoboComplexAttribute));
            }

            if (roboAttribute is RoboDatePickerAttribute)
            {
                return(RenderDatePickerAttribute(htmlHelper, roboForm, roboAttribute as RoboDatePickerAttribute));
            }

            if (roboAttribute is RoboDivAttribute)
            {
                return(RenderDivAttribute(htmlHelper, roboForm, roboAttribute as RoboDivAttribute));
            }

            if (roboAttribute is RoboFileUploadAttribute)
            {
                return(RenderFileUploadAttribute(htmlHelper, roboForm, roboAttribute as RoboFileUploadAttribute));
            }

            if (roboAttribute is RoboGridAttribute)
            {
                return(RenderGridAttribute(htmlHelper, roboForm, roboAttribute as RoboGridAttribute));
            }

            if (roboAttribute is RoboHiddenAttribute)
            {
                return(RenderHiddenFieldAttribute(htmlHelper, roboForm, roboAttribute as RoboHiddenAttribute));
            }

            if (roboAttribute is RoboHtmlViewAttribute)
            {
                return(RenderHtmlViewAttribute(htmlHelper, roboForm, roboAttribute as RoboHtmlViewAttribute));
            }

            if (roboAttribute is RoboImageAttribute)
            {
                return(RenderImageAttribute(htmlHelper, roboForm, roboAttribute as RoboImageAttribute));
            }

            if (roboAttribute is RoboLabelAttribute)
            {
                return(RenderLabelAttribute(htmlHelper, roboForm, roboAttribute as RoboLabelAttribute));
            }

            if (roboAttribute is RoboNumericAttribute)
            {
                return(RenderNumericAttribute(htmlHelper, roboForm, roboAttribute as RoboNumericAttribute));
            }

            if (roboAttribute is RoboSlugAttribute)
            {
                return(RenderSlugAttribute(htmlHelper, roboForm, roboAttribute as RoboSlugAttribute));
            }

            if (roboAttribute is RoboTextAttribute)
            {
                return(RenderTextAttribute(htmlHelper, roboForm, roboAttribute as RoboTextAttribute));
            }

            throw new ArgumentOutOfRangeException();
        }
Example #4
0
 public virtual string RenderForm <TModel>(HtmlHelper htmlHelper, RoboUIFormResult <TModel> roboForm) where TModel : class
 {
     throw new NotImplementedException();
 }