0
我有一個MVC項目。在視圖中,我使用ViewContext
像這樣從資源文件加載值。ViewContext在當前上下文中不存在
@ViewContext.HttpContext.GetGlobalResourceObject("XyzResources", "MonLabel")
我發現了一個錯誤 - The name ViewContext does not exit in current context
以下是我在頁面上添加了命名空間。
@using System.Configuration
@using System.Globalization
@using System.Web.Configuration
@using Telerik.Sitefinity.Utilities.Lucene.Net.Documents
@using Telerik.Sitefinity.UI.MVC
我不知道爲什麼它給了我這個錯誤。如果我運行錯誤的項目,它會顯示沒有任何問題的頁面。我也從資源文件中獲取值。
但我不知道如何解決它。
謝謝。
感謝您爲我提供的鏈接。我試圖使用'@ Html.Resource'它給了我Html助手不包含資源定義和最佳擴展方法重載本地化helpers.resource,你能幫助我嗎? – ISHIDA
你需要使用'@using Telerik.Sitefinity.Frontend.Mvc.Helpers'來添加 –
我做到了。它沒有幫助 – ISHIDA