ApplyMasterPageRecursive() static private method

static private ApplyMasterPageRecursive ( MasterPage master, List appliedMasterPageFiles ) : void
master MasterPage
appliedMasterPageFiles List
return void
Example #1
0
 internal static void ApplyMasterPageRecursive(MasterPage master, IList appliedMasterPageFiles)
 {
     /* XXX need to use virtual paths here? */
     if (master.MasterPageFile != null)
     {
         if (appliedMasterPageFiles.Contains(master.MasterPageFile))
         {
             throw new HttpException("circular dependency in master page files detected");
         }
         if (master.Master != null)
         {
             master.Controls.Clear();
             master.Controls.Add(master.Master);
             appliedMasterPageFiles.Add(master.MasterPageFile);
             MasterPage.ApplyMasterPageRecursive(master.Master, appliedMasterPageFiles);
         }
     }
 }
Example #2
0
        internal static void ApplyMasterPageRecursive(string currentFilePath, VirtualPathProvider vpp, MasterPage master, Dictionary <string, bool> appliedMasterPageFiles)
        {
            /* XXX need to use virtual paths here? */
            string mpFile = master.MasterPageFile;

            if (!String.IsNullOrEmpty(mpFile))
            {
                mpFile = vpp.CombineVirtualPaths(currentFilePath, mpFile);
                if (appliedMasterPageFiles.ContainsKey(mpFile))
                {
                    throw new HttpException("circular dependency in master page files detected");
                }

                MasterPage innerMaster = master.Master;
                if (innerMaster != null)
                {
                    master.Controls.Clear();
                    master.Controls.Add(innerMaster);
                    appliedMasterPageFiles.Add(mpFile, true);
                    MasterPage.ApplyMasterPageRecursive(currentFilePath, vpp, innerMaster, appliedMasterPageFiles);
                }
            }
        }