简体   繁体   中英

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.

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

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

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

Did you try

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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