现在的位置: 首页 > 综合 > 正文

表格尾部两种做法

2013年10月23日 ⁄ 综合 ⁄ 共 1610字 ⁄ 字号 评论关闭

        private string GetHtml(DataTable dt)
        {
            StringBuilder html = new StringBuilder();
            const string splitHtml = @"<td width=""3""><img src=""../images/main_34.gif"" width=""3"" height=""28"" /></td>";
            foreach (DataRow dr in dt.Rows)
            {
                html.AppendFormat(@"<td height=""23"" style=""cursor:hand"" width=""75px"">
    <a href=""Left.aspx?ModuleID={0}"" target=""menu"" ><div align=""center"" class=""STYLE3""><b>{0}</b></div></a>
</td>&", dr["ResourceId"], dr["SubSystemCName"]);
            }
            return html.ToString().TrimEnd('&').Replace("&", splitHtml);
        }

 

 

                                    <% for (int i = 0; i < this.dtResource.Rows.Count; i++)
                                       {%>
                                    <td height="23" style="cursor: hand" width="75px">
                                        <a href="Left.aspx?subSystemId=<%=this.dtResource.Rows[i]["ResourceId"] %>" target="menu">
                                            <div align="center" class="STYLE3">
                                                <b>
                                                    <%=this.dtResource.Rows[i]["ResourceName"]%></b></div>
                                        </a>
                                    </td>
                                    <% if (i != this.dtResource.Rows.Count - 1)
                                       {%>
                                    <td width="3">
                                        <img src="../images/main_34.gif" width="3" height="28" />
                                    </td>
                                    <%}
                                       }%>

抱歉!评论已关闭.