Setting multilanguage Page title from aspx
-
30-09-2019 - |
Pergunta
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 %>"
Solução
Will this work for you?
<head>
<title><%= GetGlobalResourceObject("Global", "PageTitle") %></title>
</head>
Outras dicas
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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow