frenchie
frenchie

Reputation: 51927

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.

Upvotes: 1

Views: 435

Answers (1)

Dalorzo
Dalorzo

Reputation: 20014

Do this instead:

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

Upvotes: 1

Related Questions