Click here to Skip to main content
14,773,218 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
How can i create a single HTML page with c# .net win forms.

I have the options and values stored in Db which i want to use when user clicks the button to create a HTML file.

It is easy to fetch the options and values for drop down or radio buttons .But how do i create the HTML file dynamically ..
What's the problem? How to write data in a string? What did you try, anyway?

There are no special "professional secrets" or hidden libraries to use. This is just some work to be done. Who do you thing will do it?

HTML is a string. You can string mash HTML if you want to. Where do you expect this HTML to go, though ?
gaurish thakkar 7-Aug-12 6:12am
I wanted to Use the XMLWRITER but dont know if i can write varoius functions that can modify the XMLWRITER obj....
You can use Web Browser Control for your solution.

First fetch all required Data from DB then after use String Builder to generate code same like we have doing in HTML page.

Once you have done the coding or your string is ready. Assign that string to Web Browser Control Document.


Dim sStr as New StringBuider

WebBrowser1.Document = sStr.Tostring()

I think this will work for you!
As html is a plain text, can be made with just a notepad, so you can make html with anything that can handle strings. Be aware, that html is not xml, and neither xhtml is always xml (lecture:[^]) - I suggest you treat it what it is.
So you either write the text on your own based on the standard specifications, or you can use a DOM modeler, like HTML Agility Pack[^]. This one is more useful if you tray to parse an existing html or xhtml file, but it is also usefull if you want to create one.

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