Best Way to Generate HTML And Position Using C#
Posted on 2009-04-26
I'm looking for a best practice recommendation on how to control the placement of HTML that I am generating server side within PageLoad().
I am looping through a datatable and generating some HTML for every record in the table. It's a very small about of data (less than 30 rows). I'm saving the HTML in a StringBuilder and then assigning the HTML to the text value of a label control on my ASP.NET page.
label.text = sb.ToString();
Is there a better way of accomplishing this? I'm having an issue where the html on this label isn't displaying immediately when the page loads, unless you click somewhere in the page. This only happens in IE not Firefox. I don't know if this issue is related, but I'm looking for a best practice recommendation.
Is there a better option than looping through the data during PageLoad()?