Microsoft AJAX Library (Atlas) - Sys.StringBuilder appendLine(value)

Two things to note that tripped me up with the appendLine() method of the Sys.StringBuilder in the Microsoft AJAX Library.
  • appendLine() will append a \r\n AFTER the line that is added, not create a new line (smack as my hand slaps my forehead).
  • appendLine() does not currently work on an HTML page.  This is because of the \r\n, which don't work on an html page.
This is pulled from: http://morewally.com/cs/blogs/wallym/archive/2006/09/13/347.aspx

2 Comments

  • What do you mean: "..appendLine() does not currently work on an HTML page.."

    Of course it works. It works as it should by design.

    If you want to use the Sys.StringBuilder to concatenate HTML, avoid appendLine() but instead just use append() and put appropriate HTML BR or P elements in your StringBuilder.

  • Yes, you are correct. It just doesn't work as I thought it would. :-)

Comments have been disabled for this content.