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


C# Page.LoadTemplate方法代码示例

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


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

示例1: GetColumn

        public DataControlField GetColumn(Page pageInstance, MetaField field, bool isPrimaryKey)
        {
            if (pageInstance == null)
                throw new ArgumentNullException("pageInstance");
            if (field == null)
                throw new ArgumentNullException("field");

            if (ControlPathResolver.Current == null)
                throw new ArgumentNullException("ControlPathResolver");

            TemplateField retVal = new TemplateField();

            if (!isPrimaryKey)
            {
                ResolvedPath resPath = ControlPathResolver.Current.Resolve(CHelper.GetMetaTypeName(field), "Grid", field.Owner.Name, field.Name, viewName);

                //retVal.ItemTemplate = PageInstance.LoadTemplate(MetaFieldControlPathResolver.Resolve(CHelper.GetMetaTypeName(Field)/*Field.TypeName*/, "Grid", Field.Owner.Name, Field.Name, viewName, string.Empty));
                if(resPath!= null)
                    retVal.ItemTemplate = pageInstance.LoadTemplate(resPath.Path);
            }
            else
                retVal.ItemTemplate = pageInstance.LoadTemplate("~/Apps/MetaUI/Primitives/[email protected]@.PrimaryKey.ascx");

            return retVal;
        }
开发者ID:0anion0,项目名称:IBN,代码行数:25,代码来源:ListColumnFactory.cs

示例2: GetColumn

        public DataControlField GetColumn(Page PageInstance, MetaField Field, bool IsPrimaryKey)
        {
            if (PageInstance == null)
                throw new ArgumentNullException("pageInstance");
            if (Field == null)
                throw new ArgumentNullException("field");

            TemplateField retVal = new TemplateField();

            if (!IsPrimaryKey)
            {
                string className = Field.Owner.Name;
                if (ListManager.MetaClassIsList(className))
                    className = "[email protected]";
                ResolvedPath resPath = ControlPathResolver.Current.Resolve(CHelper.GetMetaTypeName(Field), "GridEntity", className, Field.Name, viewName);

                if (resPath != null)
                    retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);
            }
            else
                retVal.ItemTemplate = PageInstance.LoadTemplate("~/Apps/MetaUIEntity/Primitives/[email protected]@.PrimaryKey.ascx");

            return retVal;
        }
开发者ID:0anion0,项目名称:IBN,代码行数:24,代码来源:ListColumnFactory.cs

示例3: GetAllowEditColumn

        public DataControlField GetAllowEditColumn(Page PageInstance, string MetaClassName)
        {
            TemplateField retVal = new TemplateField();

            string className = MetaClassName;
            if (ListManager.MetaClassIsList(className))
                className = "[email protected]";

            ResolvedPath resPath = ControlPathResolver.Current.Resolve("AllowEdit", "GridEntity", className, String.Empty, viewName);

            if (resPath != null)
                retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }
开发者ID:0anion0,项目名称:IBN,代码行数:15,代码来源:ListColumnFactory.cs

示例4: GetAllowEditColumn

        public DataControlField GetAllowEditColumn(Page PageInstance, string MetaClassName)
        {
            TemplateField retVal = new TemplateField();

            if (ControlPathResolver.Current == null)
                throw new ArgumentNullException("ControlPathResolver");

            if (PageInstance == null)
                throw new ArgumentNullException("PageInstance");

            ResolvedPath resPath = ControlPathResolver.Current.Resolve("AllowEdit", "Grid", MetaClassName, String.Empty, viewName);

            //retVal.ItemTemplate = PageInstance.LoadTemplate(MetaFieldControlPathResolver.Resolve("AllowEdit", "Grid", MetaClassName, string.Empty, viewName, string.Empty));
            if(resPath!=null)
                retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }
开发者ID:0anion0,项目名称:IBN,代码行数:18,代码来源:ListColumnFactory.cs

示例5: LoadSkinnedTemplate

        // *********************************************************************
        //  LoadSkinnedTemplate
        //
        /// <summary>
        /// Attempts to load a template from the skin defined for the application.
        /// If no template is found, or if an error occurs, a maker is added to the
        /// cache to indicate that we won't try the code path again. Otherwise the
        /// template is added to the cache and loaded from memory.
        /// </summary>
        /// 
        // ********************************************************************/
        public static ITemplate LoadSkinnedTemplate(string virtualPathToTemplate, string templateKey, Page page)
        {
            ITemplate _template;
            CacheDependency fileDep;

            // Get the instance of the Cache
            Cache cache = HttpContext.Current.Cache;

            // Attempt to load template from Cache
            if ((cache[templateKey] == null) || (cache[templateKey].GetType() != typeof(FileNotFoundException)))
            {
                try
                {
                    // Create a file dependency
                    fileDep = new CacheDependency(page.Server.MapPath(virtualPathToTemplate));

                    // Load the template
                    _template = page.LoadTemplate(virtualPathToTemplate);

                    // Add to cache
                    cache.Insert(templateKey, _template, fileDep);

                }
                catch (FileNotFoundException fileNotFound)
                {

                    // Add a marker we can check for to skip this in the future
                    cache.Insert(templateKey, fileNotFound);

                    return null;
                }
                catch (HttpException httpException)
                {

                    // Add a marker we can check for to skip this in the future
                    if (httpException.ErrorCode == -2147467259 || httpException.ErrorCode == -2147024894)
                        cache.Insert(templateKey, new FileNotFoundException("Template not found"));
                    else
                        throw httpException;

                    return null;
                }
            }
            else
            {
                return null;
            }

            // return the template from Cache
            return (ITemplate)cache[templateKey];
        }
开发者ID:Confirmit,项目名称:Portal,代码行数:62,代码来源:Globals.cs

示例6: GetCustomColumn

        public DataControlField GetCustomColumn(Page PageInstance, string MetaClassName, string ColumnType)
        {
            TemplateField retVal = new TemplateField();

            if (ControlPathResolver.Current == null)
                throw new ArgumentNullException("ControlPathResolver");

            ResolvedPath resPath = ControlPathResolver.Current.Resolve(ColumnType, "Grid", MetaClassName, viewName, String.Empty);

            if (resPath != null)
                retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }
开发者ID:0anion0,项目名称:IBN,代码行数:14,代码来源:ListColumnFactory.cs


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