AddParsedSubObject

 1
 2        protected override void AddParsedSubObject(object obj)
 3        {
 4            if (obj is LiteralControl)
 5            {
 6                string temp = ((LiteralControl)obj).Text.ToLower();
 7                if (temp.IndexOf("<body>"!= -1)
 8                {
 9                    ((LiteralControl)obj).Text = temp.Replace("<body>""<body>\r\n<hr width='100%' size='1'/>");
10                }

11                if (temp.IndexOf("</body>"!= -1)
12                {
13                    ((LiteralControl)obj).Text = temp.Replace("</body>""<hr width='100%' size='1'/>\r\n</body>");
14                }

15            }

16            base.AddParsedSubObject(obj);
17        }
上面这行代码的功能是在页面的<body>之后和</body>之前分别加一个横线,但是如果在<body>之前的代码中含有<%%>这样的代码,就不执行,不知道是什么原因???
posted @ 2008-05-14 17:00  angushine  阅读(274)  评论(0)    收藏  举报