日期:2014-05-17  浏览次数:20524 次

送分小问
http://my.csdn.net/my/album/detail/1259486#1027211

C# code

            StringBuilder sb = new StringBuilder();
            foreach (ListInfo info in list)
            {
                sb.Append("<div>");
                sb.Append("<table  cellpadding=\"0\" cellspacing=\"0\" border=\"1\" style=\"height:100%; width:100%;\">");
                sb.Append("<tr><td style=\"padding:0 0 0 10px; \" height=\"10px\">信息公告</td>");
                if (info.showMore == 0)
                {
                    sb.AppendFormat("<td style=\"padding:0 10px 0 10px; \" align=\"right\" height=\"10px\"><span style=\"cursor:pointer;\" onclick=\"{0}\">更多>></span></td>", info.showMoreLink);
                }
                sb.Append("</tr>");
                foreach (DataRow dr in info.Data.Rows)
                {
                    DateTime dt = Convert.ToDateTime(dr[1].ToString());
                    if (dr != null)
                    {
                        sb.AppendFormat("<tr><td valign=\"middle\" height=\"10px\"><ul style=\"padding:0 0 0 15px; \"><li><span style=\"cursor:pointer;\" onclick=\"{0}\"><font >{1}</font><span/></li></ul></td><td valign=\"middle\" height=\"10px\"><ul style=\"list-style:none\" ><li><font>{2}</font></li></ul></td></tr>", info.PageUrl, dr[0].ToString(), dt.ToShortDateString());
                    }

                }
                sb.Append("</table>");
                sb.Append("</div>");
            }

            return sb.ToString();

被个样式搞傻了- - 来个前端熟悉点 帮帮忙

------解决方案--------------------
用StringBuilder 拼接前台学习