简体   繁体   中英

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

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