public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type,
                                  string tagName, string ID, IDictionary attribs)
        {
            string id = null, s;

            foreach (object k in attribs.Keys)
            {
                s = k as string;
                if (String.IsNullOrEmpty(s))
                {
                    continue;
                }

                if (String.Compare(s, "id", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    id = attribs [s] as string;
                    break;
                }
            }
            base.Init(parser, parentBuilder, type, tagName, ID, attribs);
            MasterPageParser mpp = parser as MasterPageParser;

            if (mpp == null || String.IsNullOrEmpty(id))
            {
                return;
            }

            mpp.AddContentPlaceHolderId(id);
        }
Ejemplo n.º 2
0
 public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string ID, IDictionary attribs)
 {
     this._contentPlaceHolderID = ID;
     if (parser.FInDesigner)
     {
         base.Init(parser, parentBuilder, type, tagName, ID, attribs);
     }
     else
     {
         if (string.IsNullOrEmpty(ID))
         {
             throw new HttpException(System.Web.SR.GetString("Control_Missing_Attribute", new object[] { "ID", type.Name }));
         }
         this._templateName = ID;
         MasterPageParser parser2 = parser as MasterPageParser;
         if (parser2 == null)
         {
             throw new HttpException(System.Web.SR.GetString("ContentPlaceHolder_only_in_master"));
         }
         base.Init(parser, parentBuilder, type, tagName, ID, attribs);
         if (parser2.PlaceHolderList.Contains(this.Name))
         {
             throw new HttpException(System.Web.SR.GetString("ContentPlaceHolder_duplicate_contentPlaceHolderID", new object[] { this.Name }));
         }
         parser2.PlaceHolderList.Add(this.Name);
     }
 }
Ejemplo n.º 3
0
        public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
                                  Type type, string tagName, string ID, IDictionary attribs)
        {
            // Copy the ID so that it will be available when BuildObject is called
            _contentPlaceHolderID = ID;

            if (parser.FInDesigner)
            {
                // shortcut for designer
                base.Init(parser, parentBuilder, type, tagName, ID, attribs);
                return;
            }

            if (String.IsNullOrEmpty(ID))
            {
                throw new HttpException(SR.GetString(SR.Control_Missing_Attribute, "ID", type.Name));
            }

            _templateName = ID;

            MasterPageParser masterPageParser = parser as MasterPageParser;

            if (masterPageParser == null)
            {
                throw new HttpException(SR.GetString(SR.ContentPlaceHolder_only_in_master));
            }

            base.Init(parser, parentBuilder, type, tagName, ID, attribs);

            if (masterPageParser.PlaceHolderList.Contains(Name))
            {
                throw new HttpException(SR.GetString(SR.ContentPlaceHolder_duplicate_contentPlaceHolderID, Name));
            }

            masterPageParser.PlaceHolderList.Add(Name);
        }
Ejemplo n.º 4
0
 public MasterPageCompiler(MasterPageParser parser)
     : base(parser)
 {
     this.parser = parser;
 }
 internal MasterPageCodeDomTreeGenerator(MasterPageParser parser) : base(parser)
 {
     _masterPageParser = parser;
 }