I was responding to a post on how to set the value of the xml:lang attribute of the html tag in an ASP.NET Web Forum. I knew from previous work with the head element that you can manipulate these, so I did a little test. Here is what you need to do, to get it working:
- Add an id attribute to the html opening tag, say id=”htmlMain”.
- Add the runat attribute to the html opening tag, runat=”server”.
- Declare a variable of type System.Web.UI.HtmlControls.HtmlGenericControl, named htmlTag.
- Assign htmlMain to htmlTag.
- Set the existing attribute or add a new attribute and value.