在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