View Single Post
  #8 (permalink)  
Old October 22nd, 2003, 08:46 AM
stu9820 stu9820 is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Is it faster to build a table like this:
**********************
Dim tblTable as Table
Dim tblRow as TableRow
Dim tblCell as TableCell

tblTable = New Table
tblRow = New TableRow
tblCell = New TableCell

tblCell.Text = "This text would appear in the first column."
tblRow.Cells.Add(tblCell)

tblCell = New TableCell
tblCell.Text = "This text would appear in the second column."
tblRow.Cells.Add(tblCell)

tblTable.Rows.Add(tblRow)

frmFormName.Controls.Add(tblTable)
**************************


as opposed to this:
*****************
Dim strResultsHolder As String
strResultsHolder = "<table width=80% border=0 cellpadding=2 cellspacing=0>"
strResultsHolder &= "<tr><th colspan=3>" & myNews & "</th></tr>"

Dim r1 As DataRow
For Each r1 In objDataSet.Tables("dtNews").Rows
strResultsHolder &= "<tr><td width=140>" & r1("the_news") & "</td> <td>" & r1("short_sum") & "</td>"
If r1("news_link") = "No Link" Then
        strResultsHolder &= "<td width=90>No Link</td></tr>"
Else
        strResultsHolder &= "<td width=90><a href=" & r1("news_link") & " target=_blank>Get the story</a></td></tr>"
End If
Next

strResultsHolder &= "</table>"
display.InnerHtml = strResultsHolder