May 10, 2011

JavaScript with asp.net, no runat="server" please

I had this JS in my application.

Please replace all the [ ] with < > tag because HTML tag is being rendered in this post. =.=


[script language="javascript" type="text/javascript"]
        function toggle(flg) {
            var el = document.getElementById("rowCustomer");
            if (flg) {
                el.style.display = '';
            } else {
                el.style.display = 'none';
            }
        }  
[/script]

[tr id="rowCustomer" runat="server" style="display:none;"]
    [td]
        Customer
    [/td]
[/tr]

Just realized that you can't have runat="server" with Javascript hide/show visibility or the document.getElementById will not be able to get the row.

0 poops: