后台代码:
internal static StringBuilder html = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataBindLanmu();
DataBindFoot();
DataBindTBTJ();
DataBindZXWZ();
DataBindWz();
if (html.Length == 0)
{
ToHtml();
}
}
}
public void ToHtml()
{
List<Model.Lanmu> lmList = lmManage.GetLmIsShow();
for (int i = 0; i < lmList.Count; i++)
{
int divid = i + 1;
html.AppendLine("<div id=\"Div" + divid + "\">");
html.AppendLine(" <div class=\"bt\">");
html.AppendLine("<h3 class=\"h3title3\">" + lmList[i].Title + "<a href=\"Lanmu.aspx?id=" + lmList[i].Id + "\" class=\"more\" title=\"更多\">更多>></a></h3>");
html.AppendLine("<a href=\"#\"><img src=\"images/Lanmu/" + lmList[i].ImgUrl + "\" alt=\"\" width=\"110\" height=\"100\" style=\"float:left\"/></a>");
html.AppendLine("<a href=\"#\" title=\"\" class=\"aContent\" style=\"letter-spacing:2px\"> " + SetLanmuContent(lmList[i].Content) + "</a>");
html.AppendLine("</div>");
html.AppendLine("<ul>");
List<Model.WenZhang> wzList = wzManage.GetLanmuIdwz(lmList[i].Id, 6, "isShow");
for (int j = 0; j < wzList.Count; j++)
{
html.AppendLine("<li id=\"wenzhang\"><span style=\"color:#CC99CC;\">▲</span><a href=\"LanmuWenZhang.aspx?lmid=" + lmList[i].Id + "&id=" + wzList[j].Id + "\" title=\"\">" + wzList[j].Title + "</a></li>");
}
html.AppendLine("</ul>");
html.AppendLine("</div>");
}
}
internal改成protected或public试一下
StringBuilder 是类呀。不需要 .tostring() 吗?