Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 .NET3.5 HTML
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 2-Aug-12 20:22pm
Comments
Sergey Alexandrovich Kryukov at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

HTML is a string. You can string mash HTML if you want to. Where do you expect this HTML to go, though ?
  Permalink  
Comments
gaurish thakkar at 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....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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!
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 504
1 Maciej Los 349
2 Kornfeld Eliyahu Peter 325
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 18 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100