我怎樣才能爲基準的常數從page.aspx constants.cs,我想下面沒有任何成功如何從aspx引用cs中的常量?
<%@ Import Namespace="MyConstants" %>
<uc:MyControl ID="id1" runat="server" ConstantValue=" <%= Constants.TheValue %>" />
<uc:MyControl ID="id2" runat="server" ConstantValue=" <%# Constants.TheValue %>" />
<uc:MyControl ID="id3" runat="server" ConstantValue=" <%= MyConstants.Constants.TheValue %>" />
<uc:MyControl ID="id4" runat="server" ConstantValue=" <%# MyConstants.Constants.TheValue %>" />
而且在Constants.cs
namespace MyConstants
public class Constants
public const string TheValue = "Hello, World";
當我嘗試這個Constants.TheValue >> NULL – Makach