我有一个masterpage(myMaster)我有一个变量(让我们调用myInteger)我想在外部类中访问。从母版页获得价值到类
通常我只是做在我的aspx:<%@ VirtualPath的MasterType = “myMaster.master” %>
,然后我可以访问它在我的代码做背后:Master.myInteger ...
我在这里的问题是,我想访问它的另一个类(那里没有的.aspx)
我试着做 Master.MasterPageFile = “〜/ myMaster.master” Master.AppRelativeVirtualPath =“myMaster。主“
但是Master.myInteger未被识别。
我不知道我想要做什么是可能的...任何想法得到这个变量?
在别处定义财产。你试图做的不是最佳实践。 – Khan 2012-04-23 14:48:16