What's the Literal control used for and what's the difference to the Label Control in asp.net?

后端 未结 7 2061
耶瑟儿~
耶瑟儿~ 2021-01-04 02:06

What Literal control is used for in asp.net? and What is the difference between them and Label control?

7条回答
  •  孤独总比滥情好
    2021-01-04 02:35

    One thing also to note is if you are justing using it to display something and have no need for formatting the text use a Literal control. The ViewState is not as heavy with a Literal vs a Label control and when you have many of these on a page using ViewState it can really bloat your page size.

    I always ask myself, do I need to apply a custom style or formatting? Yes, use a Label. No, use a Literal.

提交回复
热议问题