【发布时间】:2014-09-02 10:44:18
【问题描述】:
我有一些包含在外部程序集中的 aspx 页面,这些页面是通过客户 PathProvider 加载的,除了页面的本地资源外,所有页面都可以正常工作。
例如,我有一个项目 Paul.Pages,在 Paul.Pages 中有许多 aspx 页面,这些都是嵌入的资源,并且是加载视图 PaulPathProvider。
我有一个页面welcome.aspx,它在Paul.Pages 中有一个标签welcomeLable(我已经将Text 属性设置为“Hello World”),我已经为这个页面生成了本地资源,现在在Paul.Pages 我也有一个带有welcome.aspx.resx 的App_LocalResources 文件夹,在.resx 文件中我有welcomeLabelResource1.Text = "Hello Paul"。
当页面加载时,我希望看到“Hello Paul”,但实际上它显示“Hello World”,暗示资源字符串没有被加载,我尝试将 Welcome.aspx.resx 设置为 Embdedded Resource 但它没有区别。
非常感谢任何帮助,这让我发疯了。
附加信息
因此,welcome.aspx 包含在程序集 OliveERP.Common 中并命名为 welcome.aspx,它具有 Build Action = Embedded Resource,因为它是使用自定义路径提供程序加载的。 OliveERP.Common 有一个 App_LocalResources 文件夹,其中包含 Welcome.aspx.resx 页面 html 是
<%@ 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 而不是 Hello Paul
【问题讨论】:
-
您是否将 meta:resourcekey 属性添加到您的标签中? msdn.microsoft.com/en-us/library/ms227427(v=vs.100).aspx如果不查看导致问题的代码,总是很难确定问题
标签: c# asp.net embedded-resource resx