Friday, September 03, 2010

How to find html tags and content inside rendered html in code behind

Finding html tags and tag content in the code behind is something you may find useful  when providing custom render time tweaks your asp.net website. By the render time you can control many more features like root URL and broken links etc. Following are two useful scripts that you may find useful when tweaking rendered html of asp.net pages.

Please consider this example:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <script language="javascript">
        function SayHello() {
            alert("Hello");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <p>This is sample paragraph and this is my image 
            <img src="Images/Picture.jpg" alt="Picture" /></p>       
    </form>
</body>
</html>

Find tag:
Example: image tag <img>
<img src="Images/Picture.jpg" alt="Picture" />
Please refer this article for more information

Find tag content:
Example: script tag content <script>
function SayHello() {
    alert("Hello");
}
Please refer this article for more information

No comments:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...