当前位置: 首页>>代码示例>>C#>>正文


C# RenderingContext.GetData方法代码示例

本文整理汇总了C#中RenderingContext.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# RenderingContext.GetData方法的具体用法?C# RenderingContext.GetData怎么用?C# RenderingContext.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderingContext的用法示例。


在下文中一共展示了RenderingContext.GetData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderModule

        public override void RenderModule(string moduleId, string skin, RenderingContext context)
        {
            var renderPath = context.GetData("renderPath", () => new List<string>());
            var isPageEditor = context.GetData("pageEditor", () => false);

            var modId = new Regex("/[^/]+$").Match(moduleId).Value.Substring(1);
            var path = "";
            if (isPageEditor)
            {
                renderPath.Add(modId);
                path = GetRenderPath(context);
                context.Writer.Write("<div class='plh module start' data-module-id='" + moduleId +
                                     "' data-path='" +
                                     path +
                                     "' data-self='" +
                                     modId +
                                     "' data-index='" +
                                     Guid.NewGuid() + "'>Module \"" +
                                     moduleId +
                                     "\" before <span class='btn-delete' data-toggle='tooltip' data-placement='top' title='Delete module.'><i class='glyphicon glyphicon-remove'></i></span></div>");
            }

            base.RenderModule(moduleId, skin, context);

            if (isPageEditor)
            {
                context.Writer.Write("<div class='plh module end' data-path='" + path + "' data-self='" + modId +
                                     "'>Module \"" +
                                     moduleId + "\" after</div>");

                renderPath.Remove(modId);
            }
        }
开发者ID:TerrificNet,项目名称:TerrificNet,代码行数:33,代码来源:PageEditDefaultTerrificTemplateHandler.cs

示例2: RenderPlaceholder

		public override void RenderPlaceholder(object model, string key, string index, RenderingContext context)
        {
            var isPageEditor = context.GetData("pageEditor", () => false);
            var renderPath = context.GetData("renderPath", () => new List<string>());

            if (isPageEditor) 
            {
                renderPath.Add(key);
                context.Writer.Write("<div class='plh start' id='plh_" +
                                     GetRenderPath(context) +
                                     "'>Placeholder \"" + key +
                                     "\" before</div>");
            }

            base.RenderPlaceholder(model, key, index, context);

            if (isPageEditor)
            {
                context.Writer.Write("<div class='plh end' id='plh_" +
                                     GetRenderPath(context) +
                                     "'>Placeholder \"" + key +
                                     "\" after</div>");

                renderPath.Remove(key);
            }
        }
开发者ID:TerrificNet,项目名称:TerrificNet,代码行数:26,代码来源:PageEditDefaultTerrificTemplateHandler.cs

示例3: RenderPartial

        public override void RenderPartial(string template, object model, RenderingContext context)
        {
            var renderPath = context.GetData("renderPath", () => new List<string>());
            var isPageEditor = context.GetData("pageEditor", () => false);

            var path = "";
            var templateId = new Regex("/[^/]+$").Match(template).Value.Substring(1);
            if (isPageEditor)
            {
                renderPath.Add(templateId);
                path = GetRenderPath(context);
                context.Writer.Write("<div class='plh template start' data-template-id='" + template +
                                     "' data-path='" +
                                     path + "' data-index='" +
                                     Guid.NewGuid() + "' data-self='" + templateId + "'>Partial Template \"" +
                                     template +
                                     "\" before <span class='btn-delete' data-toggle='tooltip' data-placement='top' title='Delete template.'><i class='glyphicon glyphicon-remove'></i></span></div>");
                
                var partial = model as PartialViewDefinition;
                if (partial != null)
                {
                    if (partial.Data == null) partial.Data = new JObject();
                }
            }

            base.RenderPartial(template, model, context);

            if (isPageEditor)
            {
                context.Writer.Write("<div class='plh template end' data-path='" + path +
                                     "' data-self='" + templateId + "'>Partial Template \"" + template +
                                     "\" after</div>");

                renderPath.Remove(templateId);
            }
        }
开发者ID:TerrificNet,项目名称:TerrificNet,代码行数:36,代码来源:PageEditDefaultTerrificTemplateHandler.cs


注:本文中的RenderingContext.GetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。