Пример #1
0
        /// <summary>
        /// Returns the HTML input elements created by the HtmlHelper EditorFor extension method
        /// together with surrounding HTML, labels and validation messages
        /// </summary>
        private static MvcHtmlString EditorControlGroup(this HtmlHelper html, string expression, string templateName = null, string htmlFieldName = null, object additionalViewData = null, Func <object, HelperResult> templateDelegate = null, GroupOptions options = null)
        {
            var editorHtml = RenderEditor(html, expression, templateName, htmlFieldName, additionalViewData, templateDelegate);
            var properties = new EditorControlGroupProperties(expression, html.ViewData, editorHtml);

            // Make properties available to partial view via ViewBag, retaining ViewData and
            // model from the current view
            html.ViewBag.EditorControlGroupProperties = properties;

            options = options ?? GroupOptions.Default;
            return(html.Partial(options.GroupTemplate));
        }
Пример #2
0
 static GroupOptions()
 {
     Default = new GroupOptions {
         GroupTemplate = "EditorControlGroup"
     };
 }