In a Master Page I have the following markup
<body id="body" runat="server">
I have set runat="server"
because I need to be able to access the body element in code-behind.
I would now like to add a JavaScript function call to the body onload
event, like this:
<body id="body" runat="server" onload="someJavaScriptFunction();">
However, this is giving my a compile error, with a message of "Cannot resolve symbol someJavaScriptFunction();". If I run the application I get an error telling me
Compiler Error Message: CS1026: ) expected
What is going on here? onload
is a client-side event, so why does the ASP.NET compiler care about this?