2012-03-24 91 views
1

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

<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(); %>

可能是什么问题?

+0

你可以把这两个片段放到上下文中吗?你可以在两者之间剪下不相关的东西。 – 2012-03-24 09:04:23

回答

1

尝试宣告你的对象的代码隐藏文件,而不是内联,并使其protected

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

那么你的直列东西应该把它捡起来。