简体   繁体   English

HTML控件文本的文字控件

[英]Literal control for text of HTML controls

Suppose I have a meta tag HTML element and that I want to store the content of the tag in a resource file and load the content at runtime, for localization purposes. 假设我有一个meta标签HTML元素,并且我想将标签的内容存储在资源文件中并在运行时加载内容,以进行本地化。 For now, this is what I do: 目前,这是我的工作:

<asp:literal runat="server" ID="TheMetaTag" /> //in markup
TheMetaTag.Text = "<meta name=\"description\" content=\"Some Text\">"; // in code behind

As you can see, the resource file contains the entire tag. 如您所见,资源文件包含整个标记。 I want the resource file to contain just the text. 我希望资源文件仅包含文本。 I tried this in the markup: 我在标记中尝试了这个:

<meta name="description" content="<asp:literal runat="server" ID="TheMetaTag" />">

Of course, this doesn't work. 当然,这是行不通的。 I was wondering how I can store just the text in the resource file and have the content of the tag added at runtime. 我想知道如何将文本仅存储在资源文件中,并在运行时添加标记的内容。

改为这样做:

<meta name="description" content="<%=someVar %>">

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

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