RazorEngine icon indicating copy to clipboard operation
RazorEngine copied to clipboard

Using Kendo Mvc Helpers in Razor on Console App

Open serafettin82 opened this issue 8 years ago • 1 comments

I need to use Kendo Mvc components inside razors on a console app. It works fine without Kendo.

@using Kendo.Mvc.UI
@using RazorEngine.Host.Console.Helpers

...

<li>
     @(Html.Kendo().Barcode().Name("mascarpone").Value("Mascarpone")
                   .Encoding(BarcodeSymbology.Code128).Width(280).Height(100))
</li>

When I try like above(Kendo.Mvc is added as reference into project) razorengine throws exception below.

An unhandled exception of type 'RazorEngine.Templating.TemplateCompilationException' occurred in RazorEngine.dll

Additional information: Errors while compiling a Template.

Please try the following to solve the situation:

  * If the problem is about missing/invalid references or multiple defines either try to load 

    the missing references manually (in the compiling appdomain!) or

    Specify your references manually by providing your own IReferenceResolver implementation.

    See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details.

    Currently all references have to be available as files!

  * If you get 'class' does not contain a definition for 'member': 

        try another modelType (for example 'null' to make the model dynamic).

        NOTE: You CANNOT use typeof(dynamic) to make the model dynamic!

    Or try to use static instead of anonymous/dynamic types.

More details about the error:

 - error: (16, 11) The type or namespace name 'Kendo' could not be found (are you missing a using directive or an assembly reference?)

Is it possible to achive Kendo Helpers usage inside razors with Razorengine ?

serafettin82 avatar May 11 '17 06:05 serafettin82

Hello,

Did you ever get this working... I am having a similar issue using Highsoft.Web.Mvc.Charts

This is the code:

@(Html.Highsoft().Highcharts( new Highcharts { .... rest of code here

This is the error:

  • error: (3978, 35) The name 'Html' does not exist in the current context

Thanks for any help in this matter.

jljaleahy avatar Jan 10 '18 16:01 jljaleahy