コード例 #1
0
        public static IHtmlContent RAPropertyBlockDisplayFor <TModel, TProperty>(
            this IHtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            string displayValueOverride = null,
            string displayValueNull     = "-",
            string displayValueUrl      = null,
            string displayValueClass    = null,
            string displayValueStyle    = null,
            string displayLabel         = null,
            string fieldNameOverride    = null)
        {
            var modelExplorer = htmlHelper.GetModelExplorer(expression);

            var content = new HtmlContentBuilder();

            content.AppendPropertyBlockDisplayHtmlStart(String.IsNullOrEmpty(displayLabel) ? modelExplorer.GetPropertyDisplayName() : displayLabel,
                                                        displayValueClass, displayValueStyle);
            content.AppendHtml(
                htmlHelper.GetValueDisplayHtml(
                    modelExplorer.Model,
                    displayValueNull,
                    displayValueUrl,
                    displayValueOverride,
                    fieldNameOverride ?? modelExplorer.Metadata.PropertyName));
            content.AppendHtml(GetPropertyBlockDisplayHtmlEnd());
            return(content);
        }
コード例 #2
0
        public static TagCloser RABeginPropertyBlockDisplayCustomFor <TModel, TProperty>(
            this IHtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            string displayValueClass = null,
            string displayValueStyle = null,
            string displayLabel      = null)
        {
            var modelExplorer = htmlHelper.GetModelExplorer(expression);

            var content = new HtmlContentBuilder();

            content.AppendPropertyBlockDisplayHtmlStart(String.IsNullOrEmpty(displayLabel) ? modelExplorer.GetPropertyDisplayName() : displayLabel,
                                                        displayValueClass, displayValueStyle);
            htmlHelper.ViewContext.Writer.Write(content);
            return(new TagCloser(htmlHelper, GetPropertyBlockDisplayHtmlEnd()));
        }
コード例 #3
0
        public static IHtmlContent RAPropertyBlockDisplay <TModel>(
            this IHtmlHelper <TModel> htmlHelper,
            string displayLabel,
            object displayValue,
            string displayValueNull  = "-",
            string displayValueUrl   = null,
            string displayValueClass = null,
            string displayValueStyle = null)
        {
            var content = new HtmlContentBuilder();

            content.AppendPropertyBlockDisplayHtmlStart(displayLabel, displayValueClass, displayValueStyle);
            content.AppendHtml(htmlHelper.GetValueDisplayHtml(displayValue, displayValueNull, displayValueUrl));
            content.AppendHtml(GetPropertyBlockDisplayHtmlEnd());
            return(content);
        }
コード例 #4
0
        public static TagCloser RABeginPropertyBlockDisplayCustom(
            this IHtmlHelper htmlHelper,
            string displayLabel,
            string displayValueClass = null,
            string displayValueStyle = null)
        {
            if (htmlHelper == null)
            {
                throw new ArgumentNullException(nameof(htmlHelper));
            }

            var content = new HtmlContentBuilder();

            content.AppendPropertyBlockDisplayHtmlStart(displayLabel, displayValueClass, displayValueStyle);
            htmlHelper.ViewContext.Writer.Write(content);
            return(new TagCloser(htmlHelper, GetPropertyBlockDisplayHtmlEnd()));
        }