Error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
Solution:
(1)
Try removing the runat=server setting in the head tag as well.
<head id="MasterHead" runat="server" >
(2)
Replace all your <%= %> tags with <%# %>
(3)
you need to move the javascript code block outside of the head tag.