%#和<%=开放标签℃之间的区别是什么?区别、标签、lt

2023-09-04 00:57:24 作者:等你

在编辑一个aspx文件,我发现用看似同样的事情,这两个打开的标签。是否有差异,如果是,是什么呢?

While editing an aspx file I found both these opening tags used for seemingly the same thing. Is there a difference and if yes, what is it?

推荐答案

<%= 是一个等同于<%Repsonse.Write ()

您可以在这里写任何内容,例如:

You can write any content out here: for example

<%=myProperty + " additional Text" %>

&LT;%#是一项具有约束力的前pression。你可以检索(在GridView的为例)当前上下文中的任何公共价值。但是你不能在这里混的内容。

<%# is a binding expression. You can retrieve any public value in the current context (for example in GridViews). But you cannot mix content here.

看看 MSDN 了解详情。