在c#中设置主页html标签 [英] set pages main html tag in c#

查看:140
本文介绍了在c#中设置主页html标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个.net c#网站,该网站提供多种语言版本。如何在页面后面的代码中设置以下主要html标记:

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?

推荐答案

当然,只需在你的页面添加一个id和 runat = server 到你的HTML标签:

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";

这篇关于在c#中设置主页html标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆