Beispiel #1
0
        public static MvcHtmlString RenderContent(HtmlHelper helper, TypeContext typeContext, RenderContentMode mode, EntityBase line)
        {
            TypeContext tc = TypeContextUtilities.CleanTypeContext((TypeContext)typeContext);

            ViewDataDictionary vdd = GetViewData(helper, line, tc);
            
            string partialViewName = line.PartialViewName ?? OnPartialViewName(tc);

            switch (mode)
            {
                case RenderContentMode.Content:
                    return helper.Partial(partialViewName, vdd);

                case RenderContentMode.ContentInVisibleDiv:
                    return helper.Div(typeContext.Compose(EntityBaseKeys.Entity),
                      helper.Partial(partialViewName, vdd), "",
                      null);
                case RenderContentMode.ContentInInvisibleDiv:
                    return helper.Div(typeContext.Compose(EntityBaseKeys.Entity),
                        helper.Partial(partialViewName, vdd), "",
                         new Dictionary<string, object> { { "style", "display:none" } });
                default:
                    throw new InvalidOperationException();
            }
        }
Beispiel #2
0
        public static MvcHtmlString RenderContent(HtmlHelper helper, TypeContext typeContext, RenderContentMode mode, EntityBase line)
        {
            TypeContext tc = TypeContextUtilities.CleanTypeContext((TypeContext)typeContext);

            ViewDataDictionary vdd = GetViewData(helper, line, tc);

            string partialViewName = line.PartialViewName ?? OnPartialViewName(tc);

            switch (mode)
            {
            case RenderContentMode.Content:
                return(helper.Partial(partialViewName, vdd));

            case RenderContentMode.ContentInVisibleDiv:
                return(helper.Div(typeContext.Compose(EntityBaseKeys.Entity),
                                  helper.Partial(partialViewName, vdd), "",
                                  null));

            case RenderContentMode.ContentInInvisibleDiv:
                return(helper.Div(typeContext.Compose(EntityBaseKeys.Entity),
                                  helper.Partial(partialViewName, vdd), "",
                                  new Dictionary <string, object> {
                    { "style", "display:none" }
                }));

            default:
                throw new InvalidOperationException();
            }
        }