Last post Dec 21, 2012 02:47 PM by fozwold
Dec 01, 2012 07:02 AM|fozwold|LINK
I am trying to parse the maps helper through razor engine in Webmatrix but it kicks an error:
RazorEngine.Templating.TemplateCompilationException: Unable to compile template. The name 'Maps' does not exist in the current context
The code is stored in a database and i can get it to parse 'normal' razor markup but it wont parse the helper.
Also how do you invoke the Html parser in RazorEnigine? at the moment i have to pass the variable through the Razor parser then the (standard) Html Parser using @Html.Raw();
The template is a CKeditor one by the way not a razor template. it works fine its just when it gets to the helper
Dec 10, 2012 01:40 AM|Angie xu - MSFT|LINK
You could use RazorEngine syntax to build robust templates, please refer the usage of
Exception Details: RazorEngine.Templating.TemplateCompilationException: Unable to compile template. The name 'Maps' does not exist in the current context
You can't parse maps helper according to the error information above.
Dec 21, 2012 02:47 PM|fozwold|LINK
razor engine doesn't use or have access to System.Web.Helpers library so you can't parse the standard web helpers with it. it uses different syntax for thing like @Html.Raw().
The solution to my problem was to not use the google maps helper and just do it the old fashioned way.
check the razor engine docs for a complete list of the helper syntax it uses.
in case anyone was wondering...