跟踪看html.AppendLine为什么没执行
  
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/

解决方案 »

  1.   

    自己已解决
    思路,先做一个循环,将分组后长度为3的标签放进一个列表,然后再循环有长度为2的标签,再循环长度为3的标签。protected string OutputHtmlBlock()
    {
    StringBuilder html = new StringBuilder();
    html.AppendLine("<span class=\"publylb\">");
    html.AppendLine("    <dl>");

    var list = GetList();
    if (list.Count > 0)
    {
    List<Tags> tagList = new List<Tags>();
    string[] strArr = { }; foreach (var obj in list)
    {
    strArr = obj.Main.Split('.');
    if (strArr.Length == 3)
    tagList.Add(obj);
    } foreach(var obj in list)
    {
    strArr = obj.Main.Split('.');
    if (strArr.Length == 2)
    {
    html.AppendLine("        <dt>" + obj.TagName + "</dt>");
    html.AppendLine("        <dd>");
    html.AppendLine("            <ol>"); foreach (var tagObj in tagList)
    {
    if (tagObj.ParentId == obj.TagId)
    html.AppendLine("          <li class=\"pubjl\"><a href=\"#\">" + tagObj.TagName + "</a><li>");
    }
    }
    if (strArr.Length == 2)
    {
    html.AppendLine("        </dd>");
    }
    }
    }
    html.AppendLine("    </dl>");
    html.AppendLine("</span>");
    return html.ToString();
    }
      

  2.   

    你这需求俩个repeater一嵌套就实现了
      

  3.   


    可惜我页面规定不能用ASP.NET服务器控件