ASP 后台写html生成前台table

后台VB:

 If Not newTable Is Nothing And newTable.Rows.Count > 0 Then
            Dim str As StringBuilder = New StringBuilder()
            str.Append("<table border='1' cellpadding='0' cellspacing='0' class='tbl' style ='text-align :center '>")
            For i = 0 To newTable.Rows.Count - 1
                If i Mod 3 = 0 Then
                    str.Append("<tr>")
                End If
                Dim path As String = newTable.Rows(i)(2).ToString.Replace("~", "..")
                str.Append("<td>")
                str.Append("<table border='0' cellpadding='0' cellspacing='0' width='220' class='tbl' style ='text-align :center '>")
                str.Append("<tr>")
                str.Append("<td style='height :80px; text-align :center '>")
                str.Append("<input  type ='image' src ='..\image\czuft.jpg'  onclick ='' style ='height:56px;width :112px'/>")
                str.Append("</td>")
                str.Append("</tr>")
                str.Append("<tr>")
                str.Append("<td style='height :140px; text-align :center;'>")
                str.Append("<input  type ='image'  src ='" & path & "'  onclick ='' style =' height:112px;width :80px' />")
                str.Append("</td>")
                str.Append("</tr>")
                str.Append("<tr>")
                str.Append("<td style ='height :30px;font-weight :bold'>" & newTable.Rows(i)(1).ToString() & "</td>")
                str.Append("</tr>")
                str.Append("<tr>")
                str.Append("<td style ='height :30px;font-weight :bold'>" & newTable.Rows(i)(3).ToString() & "</td>")
                str.Append("</tr>")
                str.Append("<tr>")
                str.Append("<td style='height :40px; text-align :right; padding-right :10px;font-weight:bold'>NO." & newTable.Rows(i)(0).ToString() & "</td>")
                str.Append("</tr>")
                str.Append("</table>")
                str.Append("</td>")
                If i Mod 3 = 2 Then
                    str.Append("</tr>")
                ElseIf i = newTable.Rows.Count - 1 Then
                    str.Append("</tr>")
                End If            Next
            str.Append("</table>")
            Me.Literal1.Text = str.ToString()
        Else

        End If

 

前台aspx:

<div runat ="server" id ="divIamge" style ="width :660px;text-align:center; padding-top:20px; padding-left :300px ">
      <asp:Literal ID="Literal1" runat ="server" Text ="XXXX" ></asp:Literal>
         </div>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值