Iam developing a Web project using Asp.net MVC3
I have a Error When click the view page like the following.
Error:Parser Error Message: The 'inherits' keyword is not allowed when a 'model' keyword is used.
Source Error:
|
But i want to use @model @inherits in the same view.
Please Solve my Error.
Regards
NagaRaju T


Sunny SharmaRank #223 · 11.1K reputationPosted Oct 5, 2013, 2:49 AM EDT
JavaScript runtime error: 'jQuery' is undefined
It simply means that your jQuery file is not being loaded.
Check properly if you've added a reference to jQuery file in your View OR in Master Layout.
Sunny SharmaRank #223 · 11.1K reputationPosted Oct 5, 2013, 2:16 AM EDT
At the first place, @model directive is an extended mechanism of binding the view to a model in ASP.NET MVC3.
in previous version of ASP.NET MVC 3 it was required to derive each view from SYstem.Web,MVC.WebView usin @inherits directive, like:
@inherits System.Web.Mvc.WebViewPage
@model MyModel
Both the keywords are not allowed together as they make no sense. Just remove the line 3:
Line 3: @inherits System.Web.Mvc.WebViewPage
and see if it works.
HTH :)
NAGARAJU TAMADA134 reputationPosted Oct 5, 2013, 2:43 AM EDT
But it causes the error like
JavaScript runtime error: 'jQuery' is undefined
NAGARAJU TAMADA134 reputationPosted Oct 5, 2013, 2:55 AM EDT
Basically.i added a predefined css file to Content folder,for predefined master page.
thats why i used
@inherits System.Web.Mvc.WebViewPage
My View file contails
@model Mvc3CssApp.Models.InsertSiteModel
@inherits System.Web.Mvc.WebViewPage
@using System.Web.Mvc @using System.Web.Mvc.Html
@{ Layout="~/Content/earthlingtwo/_MainLayout.cshtml"; }
When i use @model and @inherits keywords i gets error like
Parser Error Message: The 'inherits' keyword is not allowed when a 'model' keyword is used.
please solve my problem
Sunny SharmaRank #223 · 11.1K reputationPosted Oct 5, 2013, 3:11 AM EDT
@{ Layout="~/Content/earthlingtwo/_MainLayout.cshtml"; }
@model Mvc3CssApp.Models.InsertSiteModel
and it should work.
NAGARAJU TAMADA134 reputationPosted Oct 6, 2013, 8:05 PM EDT
Still I have a Error Like
JavaScript runtime error: 'jQuery' is undefined,
When i clear the namespaces as you said
Here I added predefined css template to Content folder for the sake of predefined master page.
That's why i am using
@inherits System.Web.Mvc.WebViewPage
@using System.Web.Mvc
@using System.Web.Mvc.Html
Iam using the following JQuery Scripts in my code
NAGARAJU TAMADA134 reputationPosted Oct 6, 2013, 8:48 PM EDT
I solved my Error by aading the following Script
Regards
NagaRaju T
Sunny SharmaRank #223 · 11.1K reputationPosted Oct 6, 2013, 9:56 PM EDT