Dynamically add HTML to ASP.NET page

前端 未结 4 475
感动是毒
感动是毒 2020-12-14 19:03

Could someone please advise what the \"correct\" method is for adding HTML content to an ASP.NET page dynamically?

I am aware of the following declarative method.

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 19:58

    There are several ways to do that, which to use really depends on your scenario and preference.

    • Web User Controls: Can be added dynamically and you get the full editor support of Visual Studio.
    • XML literals (VB.NET only): Very convenient way to quickly put together HTML in code.
    • Templates: Add a plain HTML document to your solution and include it as a resource. Then you'll get editor support and you won't clutter your code with HTML source.

提交回复
热议问题