c# - Binding a POCO to an html document and generating the result to a string -


I'm trying to return an HTML string with a method in the class library (why not ask). What I would like to do within the law, an example of a POCO from my domain will be found, then open an HTML document (maybe it's from a file or it might be a string from somewhere else), then the document Pass POCO (which is binding to POCOs properties), then generates html as a result

Has it done in the NAT framework? I saw this article on the HtmlDocument class, but was expecting all the direct elements to avoid access and assignment:

You can use the templating engine to achieve it. The first step is to define your HTML template with a placeholder for the object property value. Then you feed the templating engine with a template and an object that will give the end result. Here's an example used:

  class program {static zero main (string [] arg) {Velocity.Init (); // Define a template that will represent your HTML structure. Var template = "& lt; html> gt; body & gt; 
$ key1
$ key2.ToString ('dd / MM / yyyy ') & lt; / div & gt; & lt; / body & gt; & lt; / html & gt; "; Var context = new velococcintex (); // The values ​​you are passing can reference many properties with complex objects. Pot ("Key 1", "Hello World"); Context.Put ("key2", DateTime.Now); Var sb = new stringbiller (); Using Var (reader = new stringringer) (var author = new stringwriter (SB)) {Varying. Avlete (context, writer, blank, reader); } Console. WrightLine (SBthostring ()); // It will print: & lt; Html & gt; & Lt; Body & gt; & Lt; Div & gt; Hello World & lt; / Div & gt; & Lt; Div & gt; 16/10/2009 & lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; }}

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -