Reputation: 4092
I need to add some attributes (http://www.w3.org/International/questions/qa-http-and-lang) to the tag in an ASP.NET Page object. Note: I cannot do this in a declarative manner and have to use the server side object model to do it. Any ideas?
To add some additional information: I need to do this within the ASP.NET Page rendering life cycle. I need to add the attribute to the root element in the page.
Upvotes: 4
Views: 4308
Reputation: 86729
You should see the following MSDN article:
It looks simple enough:
myButton.Attributes.Add("myattribute", "myValue");
Update: You can do this to any element that has an id and is set with runat="server"
, for example:
<html id="htmlTag" runat="server" ...
this.htmlTag.Attributes.Add("myAttribute", "myValue");
Upvotes: 5
Reputation: 1340
I think the HTML Agility Pack will give you what you're looking for.
Upvotes: 0