Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Issue with razor views while developing custom add-on

$
0
0

I've come across an issue while creating a custom MVC add-on. I have managed to find work-arounds to get it working but it would be useful to know if I'm doing anything wrong or missing anything.

I have created an MVC GuiPlugin but I seem to have issues with Episerver recognising referenced namespaces in the razor views. As far as I can tell, the issue seems to be that Episerver is ignoring the web.config in the root of my view folder.

  • If I use @model syntax, I get the error "the name 'model' does not exist in the current context". Workaround is to use @inherits System.Web.Mvc.WebViewPage instead
  • Using html helpers such as @Html.HiddenFor gives throws an error too, unless I explicitly reference the library at the top of the view e.g. @using System.Web.Mvc.Html

This is the web config for my Views folder https://github.com/zone/Zone.Episerver.PropertyViewer/blob/develop/src/Zone.Episerver.PropertyViewer/Views/web.config

Is there anyway to get Epi to recognise the referenced namespaces so I can write razor views in a more standard way?


Viewing all articles
Browse latest Browse all 9076

Trending Articles