Click here to Skip to main content
15,889,176 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 ..
Posted
Comments
Sergey Alexandrovich Kryukov 3-Aug-12 1:28am    
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?
--SA

HTML is a string. You can string mash HTML if you want to. Where do you expect this HTML to go, though ?
 
Share this answer
 
Comments
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.

E.g.

Dim sStr as New StringBuider
sStr.Append("<HTML>ALL YOUR CODE HERE</HTML>")

WebBrowser1.Document = sStr.Tostring()

I think this will work for you!
 
Share this answer
 
v2
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: https://www.webkit.org/blog/68/understanding-html-xml-and-xhtml/[^]) - 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.
 
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