2014-09-02 107 views
0

我有一些aspx页面包含在外部程序集中,这些页面是通过一个客户端PathProvider加载的,除了页面的本地资源外,所有工作都正常。Web应用程序App_LocalResources不工作

因此,例如,我有一个项目Paul.Pages,在Paul.Pages内有多个aspx页面,这些都是嵌入式资源并且都加载了视图PaulPathProvider。

我有页面welcome.aspx有一个单标签welcomeLable(我已经设置Text属性为“Hello World”)在Paul.Pages,我已经生成本地资源为这个页面,现在在Paul.Pages I在.resx文件中也有一个带有welcome.aspx.resx的App_LocalResources文件夹,我有welcomeLabelResource1.Text =“Hello Paul”。

当页面加载时我希望看到“Hello Paul”,但实际上它显示“Hello World”意味着资源字符串没有被加载,我尝试将welcome.aspx.resx设置为Embdedded Resource,但它使没有区别。

任何帮助非常感谢,这是让我疯狂。

Addiontal信息

所以welcome.aspx被包含在组装OliveERP.Common并welcome.aspx命名,这已建立行动=嵌入的资源,因为它是使用自定义路径提供加载。该OliveERP.Common具有包含welcome.aspx.resx的HTML页面本身的App_LocalResources文件夹是

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="welcome.aspx.cs"  Inherits="OliveERP.Common.welcome" culture="auto" meta:resourcekey="PageResource1"  uiculture="auto" %> 

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
     <asp:Label runat="server" ID="welcomeLabel" Text="Hello World"  meta:resourcekey="welcomeLabelResource1" /> 
    </div> 
    </form> 
</body> 
</html> 

但页面仍然显示的Hello World没有你好保罗

+0

你是否为你的标签添加了meta:resourcekey属性? http://msdn.microsoft.com/en-us/library/ms227427(v=vs.100).aspx它总是很难确定一个问题,而不看到导致它的代码 – fuchs777 2014-09-02 11:15:58

回答

0

似乎以下是你的问题

在.resx文件中,我有welcomeLabel.Text =“Hello Paul”。

<asp:Label runat="server" ID="welcomeLabel" Text="Hello World"  meta:resourcekey="welcomeLabelResource1" /> 

当你的标签的获取ResourceKey是welcomeLabelResource1然后在您的resx文件,你应该有一个Text属性的资源串welcomeLabelResource1.Text。

+0

对不起,这是一个错误的资源文件其实welcomeLabelResource1.Text =“你好保罗” – LoanRanger 2014-09-02 13:18:49

+0

下一步将看看你的项目的文件夹结构像这样http://meta.stackexchange.com/questions/147467/is-there-a-good-way-to-represent -file-structure-in-a-question-answer来知道你的aspx和resx文件的位置 – fuchs777 2014-09-03 17:21:35

相关问题