从 aspx 设置多语言页面标题
我问了几个关于 ASP.NET 中的多语言的问题,我非常感激,因为答案很有帮助。
我现在面临另一个问题。
我有页面指令:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="Galeria.aspx.cs" Inherits="TerapiaFisica.Galeria" %>
我想要的是使标题成为多语言。
我知道我可以通过代码隐藏来做到这一点,如下所示:
protected void Page_Load(object sender, EventArgs e)
{
Page.Title = (string)GetLocalResourceObject("PageTitle");
}
但这正是我不想做的。我想通过 aspx 的页面指令中的标签使该标题成为多语言。
谁能告诉我该怎么办?
我尝试了这两个选项,但没有一个有效:
<%@ Page Title=" <%= GetGlobalResourceObject("Global", "PageTitle") %>"
和
<%@ Page Title="<asp:Localize Text="<%$ Resources: Global, PageTitle %>"
I had asked a couple of question about multilanguage in asp.net and I am very grateful because the answers have been of much help.
I now face another problem.
I have the page directive:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="Galeria.aspx.cs" Inherits="TerapiaFisica.Galeria" %>
What I want is to make the Title multilanguage.
I know i can do that from code behind with something like this:
protected void Page_Load(object sender, EventArgs e)
{
Page.Title = (string)GetLocalResourceObject("PageTitle");
}
But that's exactly what i don't want to do. I want to make that title multilanguage from the tag in the page directive of the aspx.
Anyone can tell me what to do?
I tried this two options but none of them works:
<%@ Page Title=" <%= GetGlobalResourceObject("Global", "PageTitle") %>"
and
<%@ Page Title="<asp:Localize Text="<%$ Resources: Global, PageTitle %>"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这对你有用吗?
Will this work for you?
我面前没有 IDE,但你写的(下面)看起来错误
你尝试过吗
I don't have my IDE in front of me, but the one you wrote (below) looks wrong
Did you try