Adding attributes to <body> on master
Im using a master page.. main.master. Now from a normal page that uses the master i need to add an attribute to the Master pages body tag.
Please help me get this right.
<body runat="server" id="Body">
then expose methods to manipulate the of the master page.
Finally address it user the Master property of the content page.
A properly designed web page written to modern standards should never have any attributes on the body tag as there are better ways of attaching all of the things that can be put there.
I would disagree. There are times when you simply need to add attributes to the BODY tag - e.g. when you're adding page specific styling via CSS or coding for backwards compatibility.
As there is only ever one body tag you don't need to add anything to the tag itself. You can apply any styling using:
document.getElementsByTagName('body').style = ...
I quite often apply ID or CLASS attributes to the BODY tag to help identify the current page. For example...
With this I can then use CSS to style the page and navigation menus on a section to section basis.