3

I'm programatically creating a simple HTML file which is saved directly to disk. I was looking at this example: http://www.dotnetperls.com/htmltextwriter

I'm confused why he mixes HtmlTextWriter's Render and Write methods, and how I should choose between RenderBeginTag() and WriteBeginTag().

Are there are hard rules on what is right & wrong?

Rup
  • 33,765
  • 9
  • 83
  • 112
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
  • The difference appears to be that WriteBeginTag just generates the " – Rup Feb 12 '13 at 18:33
  • If you want the rep, can you write that up as an answer @Rup – Mr. Boy Feb 20 '13 at 11:19
  • Thanks, but I know that's not the whole answer. I'd rather someone who's used RenderBeginTag etc. explained how to use it properly, and I'd vote that up. – Rup Feb 20 '13 at 11:53
  • Does this answer your question? [What's the point in using RenderBeginTag & RenderEndTag](https://stackoverflow.com/questions/1066189/whats-the-point-in-using-renderbegintag-renderendtag) – Dai May 26 '20 at 07:26
  • 7 years later no one still knows the answer ?! – joedotnot Sep 26 '20 at 11:15

1 Answers1

-2

Use the RenderBeginTag overload of the RenderBeginTag(HtmlTextWriterTag) method if the markup element is of a known type that is one of the HtmlTextWriterTag enumeration values.

U1199880
  • 907
  • 1
  • 10
  • 21
  • No, that - which you've copied straight out of the docs - is not relevant. That's telling you whether to choose the [tag](http://msdn.microsoft.com/en-us/library/3e111b82.aspx) or the [string](http://msdn.microsoft.com/en-us/library/f2a9a9ww.aspx) variants on RenderBeginTag. That's not the distinction between RenderBeginTag and WriteBeginTag. – Rup Feb 12 '13 at 18:08