且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是LiteralControl?为什么要使用它?

更新时间:2022-05-31 04:00:49

MSDN 的文字重新控制presents HTML元素,文本和其他任何字符串不需要在服务器上处理ASP.NET页面。

From MSDN Literal Control represents HTML elements, text, and any other strings in an ASP.NET page that do not require processing on the server.

也有一看这对Literal控制使用

A 标签呈现一个<跨度> 标记。它允许您以编程方式更改
显示要显示一些文本的特征。 A LiteralControl
正是使你想让它到任何静态HTML。没有一般
优势使用一个比其他的。一个可以比另一个更有益
在某些情况下。例如,如果你想显示静态文本,
做出它没有方案变化,你可能想使用
LiteralControl。

A label renders a <span> tag. It allows you to programmatically change the display characteristics of some text you want to display. A LiteralControl renders exactly whatever static HTML you want it to. There is no general advantage of using one over the other. One may be more useful than another in certain circumstances. For example, if you want to display static text, and make no programmatic changes to it, you might want to use a LiteralControl.