MVC: Nasty __o not declared
Posted
by xamlnotes
on Geeks with Blogs
See other posts from Geeks with Blogs
or by xamlnotes
Published on Fri, 04 Mar 2011 17:07:59 GMT
Indexed on
2011/03/04
23:25 UTC
Read the original article
Hit count: 239
I ran into this little error with MVC where a bunch of errors showed up about __o not declared. This was driving me nuts. Then I ran across this link that solved it.
http://stackoverflow.com/questions/750902/how-do-i-get-rid-of-o-is-not-declared
So, the solution is to put this into the top of the page like VS does for your site.master.
<%-- The following line works around an ASP.NET compiler warning --%>
<%: ""%>
But what about other pages?
Lets say you have a view that’s using your site master and that view is throwing this error. Just add the items into the content section where the error occurs like so:
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
<%-- The following line works around an ASP.NET compiler warning --%>
<%: ""%>
Then add the rest of your code. That seems to fix it and its pretty simple too.
© Geeks with Blogs or respective owner