簡體   English   中英

編譯錯誤-內聯代碼

[英]Compilation error - inline code

我的應用程序使用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(); %>

可能是什么問題?

嘗試在代碼隱藏文件(而不是內聯)中聲明您的對象,並使其protected

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

那么您的內聯內容就可以了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM