1

我正在为我的应用程序使用 3 层架构。我正在使用内联代码来调用业务逻辑中的某些方法。我有一个返回特定字符串消息的方法。以下代码返回错误

<div id="logo">
<h1><a href="/" title='<%= systemMessagesBL.ReturnMessage("MSG_MAINPAGE_TOOLTIP", 1) %>'>Application</a></h1>
</div>

错误是:CS0103: The name 'systemMessagesBL' does not exist in the current context。虽然我已经使用以下嵌入式代码引用了它:

<% BusinessLogic.SystemMessagesBL systemMessagesBL = new BusinessLogic.SystemMessagesBL(); %>

可能是什么问题?

4

1 回答 1

1

尝试在代码隐藏文件中声明您的对象,而不是内联,并使其protected

protected BusinessLogic.SystemMessagesBL systemMessagesBL = 
   new BusinessLogic.SystemMessagesBL();

那么你的内联东西应该把它捡起来。

于 2012-03-24T09:11:17.843 回答