如何从 page.aspx 中的 constants.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";