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>之前的代码中含有<%%>这样的代码,就不执行,不知道是什么原因???

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
}

浙公网安备 33010602011771号