How to modify the HTML and BODY tags in an ASP.NET page without adding runat=server to the elements?

Posted by jon333 on Stack Overflow See other posts from Stack Overflow or by jon333
Published on 2011-11-22T08:18:12Z Indexed on 2011/11/22 9:53 UTC
Read the original article Hit count: 253

Filed under:
|
|
|

In an ASP.NET web forms project that is not quite ready to be upgraded from 2.0 to 4.0 , there is a change that needs to be made to allow modifications to the HTML and BODY tags on the pages without adding runat=server to the tags which results in the 2.0 styled "ugly ids" like "ctrl_100..."

For example, how could we change these using JavaScript, a Response Filter (the regex to find these specific tags would really help on this one), or something else...from:

<html xmlns="//www.w3.org/1999/xhtml">
<body>

To:

<html lang="jp=JP" xmlns="//www.w3.org/1999/xhtml" dir="rtl">
<body dir="rtl">

JavaScript seems like a possibility, but functions from the server-side could would determine the language and direction the page should have.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET