MasterPageCodeDomTreeGenerator.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / Compilation / MasterPageCodeDomTreeGenerator.cs / 1 / MasterPageCodeDomTreeGenerator.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Web.Compilation { 
 
    using System;
    using System.CodeDom; 
    using System.Globalization;
    using System.Web.UI;

    internal class MasterPageCodeDomTreeGenerator : TemplateControlCodeDomTreeGenerator { 

        private const string _masterPropertyName = "Master"; 
        protected MasterPageParser _masterPageParser; 
        MasterPageParser Parser { get { return _masterPageParser; } }
 
        internal MasterPageCodeDomTreeGenerator(MasterPageParser parser) : base(parser) {
            _masterPageParser = parser;
        }
 
        protected override void BuildDefaultConstructor() {
            base.BuildDefaultConstructor(); 
 
            foreach(string placeHolderID in Parser.PlaceHolderList) {
                BuildAddContentPlaceHolderNames(_ctor, placeHolderID); 
            }
        }

        private void BuildAddContentPlaceHolderNames(CodeMemberMethod method, string placeHolderID) { 
            CodePropertyReferenceExpression propertyExpr = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "ContentPlaceHolders");
            CodeExpressionStatement stmt = new CodeExpressionStatement(); 
            stmt.Expression = new CodeMethodInvokeExpression(propertyExpr, "Add", new CodePrimitiveExpression(placeHolderID.ToLower(CultureInfo.InvariantCulture))); 

            method.Statements.Add(stmt); 
        }

        protected override void BuildMiscClassMembers() {
            base.BuildMiscClassMembers(); 

            if (Parser.MasterPageType != null) 
                BuildStronglyTypedProperty(_masterPropertyName, Parser.MasterPageType); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Web.Compilation { 
 
    using System;
    using System.CodeDom; 
    using System.Globalization;
    using System.Web.UI;

    internal class MasterPageCodeDomTreeGenerator : TemplateControlCodeDomTreeGenerator { 

        private const string _masterPropertyName = "Master"; 
        protected MasterPageParser _masterPageParser; 
        MasterPageParser Parser { get { return _masterPageParser; } }
 
        internal MasterPageCodeDomTreeGenerator(MasterPageParser parser) : base(parser) {
            _masterPageParser = parser;
        }
 
        protected override void BuildDefaultConstructor() {
            base.BuildDefaultConstructor(); 
 
            foreach(string placeHolderID in Parser.PlaceHolderList) {
                BuildAddContentPlaceHolderNames(_ctor, placeHolderID); 
            }
        }

        private void BuildAddContentPlaceHolderNames(CodeMemberMethod method, string placeHolderID) { 
            CodePropertyReferenceExpression propertyExpr = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "ContentPlaceHolders");
            CodeExpressionStatement stmt = new CodeExpressionStatement(); 
            stmt.Expression = new CodeMethodInvokeExpression(propertyExpr, "Add", new CodePrimitiveExpression(placeHolderID.ToLower(CultureInfo.InvariantCulture))); 

            method.Statements.Add(stmt); 
        }

        protected override void BuildMiscClassMembers() {
            base.BuildMiscClassMembers(); 

            if (Parser.MasterPageType != null) 
                BuildStronglyTypedProperty(_masterPropertyName, Parser.MasterPageType); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK