?
Solved

Best Way to Generate HTML And Position Using C#

Posted on 2009-04-26
4
Medium Priority
?
310 Views
Last Modified: 2013-11-07
Hello Experts,

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()?
0
Comment
Question by:soapygus
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
AsishRaj earned 1000 total points
ID: 24238592
0
 
LVL 14

Assisted Solution

by:GiftsonDJohn
GiftsonDJohn earned 1000 total points
ID: 24238673
Hi,

Use HtmlTextWriter class to generate html at runtime. Of course you will use StringBuilder class here but the html code is generated using HtmlTextWriter.

http://dotnetperls.com/Content/HtmlTextWriter.aspx

http://www.4guysfromrolla.com/articles/091102-1.aspx

http://www.brainbell.com/tutorials/ASP/HtmlTextWriter_And_Controls.html
0
 
LVL 9

Expert Comment

by:AsishRaj
ID: 24256877
if you need any help, we are always here to help
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question