I have a view using a master page that contains some javascript that needs to be executed using the OnLoad of the Body. What is the best way to set the OnLoad on my MasterPage only for certain views?
On idea I tried was to pass the name of the javascript function as ViewData. But I dont really want my Controllers to have to know about the javascript on the page. I really don't like this approach...
<body onload="<%=ViewData["Body_OnLoad"]%>">
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
Edit - I suppose one idea would be to use jQuery's document ready event instead...
Any other ideas?