syncfusion error render chart convert void to object

640 views Asked by At

This is my first time use syncfusion for asp mvc 5 razor

I want to create a chart, in my learning i found error in my first.

@(Html.EJ().Chart("container").Render())

that is my code in cshtml and this is my error :

Cannot implicitly convert type 'void' to 'object'

how to solve this?

2

There are 2 answers

0
MICHAEL PRABHU On

This happens because of specifying the “.Render()” This structure was followed in Syncfusion Essential studio version 12.1.0.36. But it was changed in the future release. Please find the below code snippet for initializing a chart control.

[CSHTML]
@(Html.EJ().Chart("container"))

This standard is followed from Syncfusion Essential studio version 12.2.0.36 to current versions.

Thanks,

0
Madhu On

The parenthesis used in Html helper (@(Html.EJ) defines an explicit expression and the curly brackets(@{Html.EJ) defines a regular C# code block. The difference is that the explicit expression submits its output directly as a part of the HTML mark up and the code block doesn't.

And so if you want to use Render then use your code within the code block ({}).

@{ Html.EJ()

      …

  .Render()}