amateur
amateur

Reputation: 44615

set pages main html tag in c#

I am writing a .net c# website which is available in multiple languages. How can I set the following main html tag in code behind of a page:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

Is this possible?

Upvotes: 0

Views: 1216

Answers (1)

ashelvey
ashelvey

Reputation: 1355

Sure, just add an id and runat=server to your HTML tag in your page:

<html id="html" runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Then in your code behind you can set whatever you'd like:

    html.Attributes["xml:lang"] = "somethingelse";
    html.Attributes["lang"] = "somethingelse";

Upvotes: 1

Related Questions