问题
I am trying to get an explicit localization expression for a page title, but can't seem to figure out how, and a google search comes up with nothing.
With a control, it's nice and easy:
<asp:literal runat="server" text="<%$ Resources:MyResource, StringId %>" />
But how does one do this for the page title? I've tried specifying it in the page directive, but that of course doesn't work:
<%@ Page Title="<%$ Resources:MyResource, StringId %>" ...
Is there a way to do this? Or is it simply not possible?
回答1:
You can also use either
Page.Title = Resources.MyResource.StringId;
or
<title><%= Resources.MyResource.StringId %></title>
回答2:
simply in the page load event write
Page.Title="any String u want";
来源:https://stackoverflow.com/questions/5644809/using-an-explicit-localization-expression-for-a-page-title