public static MvcHtmlString DisplayFor <TModel>(this HtmlHelper <TModel> htmlHelper, Member member)
        {
            var names = RunningObjectsViewEngine.GetTemplateNames(member);

            foreach (var result in names.Select(name => GetDisplayFor(htmlHelper, member, name)))
            {
                if (result != null && !string.IsNullOrEmpty(result.ToHtmlString()))
                {
                    return(result);
                }
            }
            return(new MvcHtmlString(htmlHelper.Encode(member.Value)));
        }
Esempio n. 2
0
        public static MvcHtmlString EditorFor <TModel>(this HtmlHelper <TModel> htmlHelper, Member member)
        {
            foreach (var name in RunningObjectsViewEngine.GetTemplateNames(member))
            {
                var result = GetEditorFor(htmlHelper, member, name);
                if (result != null && !string.IsNullOrEmpty(result.ToHtmlString()))
                {
                    return(result);
                }
            }

            return(new MvcHtmlString(htmlHelper.Encode(member.Value)));
        }