在ASP.net中,我尝试设置一个隐藏字段的变量值,但是我得到了异常。将ASP.net设置为隐藏窗体控件的值
在第一个输出中,它是正确的。然后我把它放到隐藏的领域,失败了。
如何解决?
user name: <%= User.Identity.Name %> // output is correct
<form runat=Server>
<asp:HiddenField id="HiddenField1" value=<%= User.Identity.Name %> runat=Server />
</form>
错误
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Server tags cannot contain <% ... %> constructs.
请看我下面的评论。 – user595234 2012-07-20 16:04:45