Datatable to html Table

前端 未结 8 2056
感动是毒
感动是毒 2020-11-27 14:42

I have question, that maybe someone here wouldn\'t mind to help me with. I have lets say 3 datatables, each one of them has the following columns:

size, quantity, amo

8条回答
  •  长情又很酷
    2020-11-27 15:34

    Just in case anyone arrives here and was hoping for VB (I did, and I didn't enter c# as a search term), here's the basics of the first response..

    Public Shared Function ConvertDataTableToHTML(dt As DataTable) As String
        Dim html As String = ""
        html += ""
        For i As Integer = 0 To dt.Columns.Count - 1
            html += ""
        Next
        html += ""
        For i As Integer = 0 To dt.Rows.Count - 1
            html += ""
            For j As Integer = 0 To dt.Columns.Count - 1
                html += ""
            Next
            html += ""
        Next
        html += "
    " + System.Web.HttpUtility.HtmlEncode(dt.Columns(i).ColumnName) + "
    " + System.Web.HttpUtility.HtmlEncode(dt.Rows(i)(j).ToString()) + "
    " Return html End Function

提交回复
热议问题