简体   繁体   English

从aspx设置多语言页面标题

[英]Setting multilanguage Page title from aspx

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. 我在asp.net上问了几个关于多语言的问题,我非常感激,因为答案很有帮助。

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. 我想从aspx的page指令中的标记中创建该标题多语言。

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 %>"

Will this work for you? 这对你有用吗?

<head>
    <title><%= GetGlobalResourceObject("Global", "PageTitle") %></title>
</head>

I don't have my IDE in front of me, but the one you wrote (below) looks wrong 我没有在我面前的IDE,但你写的那个(下面)看起来不对

<%@ Page Title=" <%= GetGlobalResourceObject("Global", "PageTitle") %>"

Did you try 你试过了吗

<title>
    <%= GetGlobalResourceObject("Global", "PageTitle") %>
<title>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM