I am trying to get my razor page to run but I keep getting this error:
ASP._Page_Views_profile_add_cshtml.Execute()': no suitable method found to override
and in doing some research I have found out that I needed to add some things to the web.config which I have done but also that I need to add the "@model" to the top and provide a model. So far I have this:
@model ProfileViewModel
@{
ViewBag.Title = "Add";
Layout = "~/Views/Shared/_Master.cshtml";
}
the @model
keyword does not work, its not highlighted yellow like the @inherits
keyword would be, I believe that is my problem but no clue on how to fix it. Can someone please help?
The
@model
keyword won't be highlighted in yellow in the Visual Studio designer. It needs to point to a valid class so that if you put the cursor over it and press F12 you should navigate to the corresponding class definition. If this doesn't happen you might need to specify the full type name including the namespace.Also the controller action that is rendering this particular view needs to pass an instance of the model: