Click here to Skip to main content
15,920,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to every body. I am new for creating html dynamically. My requirement is that, i created one aspx page, In that I have some content and one button. When i click the button one html page need to generate with my content. Can anyone help me to generate html pages dynamically.
Updated 10-Feb-17 17:56pm

The simplest way would be creating a String with StringBuilder Class and assign the contents to its object.

See one example[^].
Share this answer
Brady Kelly 11-Dec-17 7:01am    
Concatenating or buiolding strings is a most clumsy way of creating an HTML page. There are HTML and XML specific classes to help us do this properly, like building a house according to plan instead of a plain, round mud hut.
I agree. Why don't you add a comment saying the alternate way to this answer. People coming to this post would know both. :)
Is using something like Razor not applicable here? Because if you're doing a lot of html generation using a view engine can make it a lot easier. It was also built to be used outside of ASP.NET.

However sometimes that's not what you need. Have you considered using the TagBuilder class which is part of .net (mvc)? There is also the HtmlWriter in System.Web.UI (for web forms). I would recommend one of these if you are making Controls or Html Helpers
Share this answer
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900