I am maintaining a classic ASP application. It has some reports and few of them has around 25 columns and around 600 rows. I return the data from the server to the client over an AJAX call and display the results.
What I do is I create the HTML string for a table with the header and rows on the server side (using string concatenation) and do a response.write
at the end.
if not rsStatus.eof then
strresult=strresult & "<table class='sort-table' id='table-1'><thead><tr class='gridHeader' style='height:15px;'>"
strresult=strresult & "<td>S.N.</td>"
strresult=strresult & "<td>TSPL Job No.</td>"
strresult=strresult & "<td>Client Name</td>"
strresult=strresult & "<td>Job Type</td>"
strresult=strresult & "<td>Govt Office</td>"
strresult=strresult & "<td>Ref Value</td>"
strresult=strresult & "<td>Govt File No.</td>"
strresult=strresult & "<td>Submission Date</td>"
strresult=strresult & "<td>Days Elasped Since Filing Date</td>"
strresult=strresult & "<td>Process-Cycle/Status stage</td>"
strresult=strresult & "<td>Status/ Remarks</td>"
strresult=strresult & "<td>Status Last Updated on</td>"
strresult=strresult & "<td>Trigon Bill No</td>"
strresult=strresult & "<td>Trigon Bill Date</td>"
strresult=strresult & "<td>Payment Received / Pending</td>"
strresult=strresult & "</thead></tr><tbody>"
dim rownum
rownum = 1
while not rsStatus.eof
strresult=strresult & "<tr class='gridrow " & IIf(rownum Mod 2=1,"bgodd","bgeven") &"'>"
strresult=strresult & "<td>" & rownum & "</td>"
strresult=strresult & "<td><a href='http://localhost/app/global/weblets/Jobdetails.asp?JobId=" & rsStatus("iJobId") & "' target='new'>" & rsStatus("vJobNo") & "</a></td>"
strresult=strresult & "<td>" & rsStatus("Client") & "</td>"
strresult=strresult & "<td>" & rsStatus("vJobType") & "</td>"
strresult=strresult & "<td>" & rsStatus("GovtOffice") & "</td>"
strresult=strresult & "<td>" & rsStatus("RefVal") & "</td>"
strresult=strresult & "<td>" & rsStatus("FileNo") & "</td>"
strresult=strresult & "<td>" & rsStatus("SubmitedOn") & "</td>"
strresult=strresult & "<td>" & rsStatus("elapsed") & "</td>"
strresult=strresult & "<td>" & rsStatus("CurrentStatus") & "</td>"
strresult=strresult & "<td>" & rsStatus("comment") & "</td>"
strresult=strresult & "<td>" & rsStatus("dStatusDate") & "</td>"
strresult=strresult & "<td>" & rsStatus("BillNo") & "</td>"
strresult=strresult & "<td>" & rsStatus("BillDate") & "</td>"
strresult=strresult & "<td>" & rsStatus("PymtStatus") & "</td>"
strresult=strresult & "</tr>"
rownum = rownum+1
rsStatus.movenext
wend
strresult=strresult & "</tbody></table>"
else
strresult=strresult & "<tr class='gridrow'><td colspan=3>No Status Present for the Job</td></tr>"
end if
Response.Write(strresult)
The performance is not very good as the no of rows is increasing.
What might be a better way to do it?