'HtmlHelper<dynamic>' does not contain a definition for 'EJS'

I have an ASP.NET MVC application using Syncfusion version 15.3.0.33

I want to use functionality that is available on the JS2 framework.

I installed Syncfusion version 17.4.0.46.

I added reference: 

C:\Program Files (x86)\Syncfusion\Essential Studio\ASP.NET MVC - EJ2\17.4.0.46\NuGetPackages\Syncfusion.EJ2.MVC5\17.4.0.46\lib\net45\Syncfusion.EJ2.dll

I created a very basic diagram.

Controller:

    public ActionResult Index()
    {
        return View();
    }

Index.cshtml

    @using Syncfusion.EJ2.Diagrams;


    <div>
        @(Html.EJS().Diagram("container").Width("100%").Height("700px").Created("diagramCreated").SnapSettings(s => s.HorizontalGridlines(ViewBag.gridLines).VerticalGridlines(ViewBag.gridLines))
                    .GetNodeDefaults("getNodeDefaults").GetConnectorDefaults("getConnectorDefaults").Nodes(ViewBag.nodes).Connectors(ViewBag.connectors).Render()
        )
    </div>

I am receiving the below error:


What do I still need to do to accomplish this?

Thanks,

Neill




7 Replies 1 reply marked as answer

NG Naganathan Ganesh Babu Syncfusion Team August 28, 2020 12:28 PM UTC

Hi Neill, 
 
The issue was resolved by adding the Syncfusion namespace reference element in web config file. We need to add Syncfusion’s namespace element in web.config file which has shown in below image. 
 
 
Also please refer the below attached sample. 
 
 
Regards, 
 
Naganathan K G 



NE Neill August 31, 2020 09:18 AM UTC

Thank you for the reply.

There seems to be some sort of conflict.

After adding the namespace as suggested, when navigating to EJ2/Index, I get the following error:

The call is ambiguous between the following methods or properties:
 'Syncfusion.EJ2.Diagrams.DiagramSnapSettingsBuilder.HorizontalGridlines(Syncfusion.EJ2.Diagrams.DiagramGridlines)' and 
 'Syncfusion.EJ2.Diagrams.DiagramSnapSettingsBuilder.HorizontalGridlines(System.Action<Syncfusion.EJ2.Diagrams.DiagramGridlinesBuilder>)'

Thanks

Neill


NE Neill August 31, 2020 03:22 PM UTC

I am no longer receiving the conflict, but now receive the following error:





Neill


AR Aravind Ravi Syncfusion Team September 1, 2020 10:02 AM UTC

Hi Neil, 
 
We are unable to reproduce the reported issue at our end. We suspect that the issue occurs due to you have set one of the symbol palette property as string, so that reported issue occurs. So please change that property to string type. We have attached a sample that run without any errors. Please find the sample in below link 
 
 
In case if issue still persists, please share us a simple sample illustrating the issue or modify the above sample illustrating issue. This will help us to proceed further. 
 
Regards 
Aravind Ravi 


Marked as answer

NE Neill September 2, 2020 01:35 PM UTC

Hi,

I downloaded and tested the sample application you provided and it works just like it should.

I created a new ASP.NET MVC application, Added the NuGet packages for:

Syncfusion.EJ2.MVC5
Syncfusion.EJ2.JavaScript
Syncfusion.Licensing

I then copied the code from the sample application across to the new application and also add the namespace for Syncfusion.EJ2 to the web.config file.
The new application didn't give any errors but also didn't display anything on the View.
After a bit of digging around I saw in _Layout.cshtml there is the line:

    @Html.EJS().ScriptManager()

I added that to the new application and then it worked as expected.

However my existing application still does not work with the same code as the sample application.
I didn't get errors but also nothing shows on the View.
I added  @Html.EJS().ScriptManager() to the _Layout.cshtml and now receive the following error when navigating to view.





Neill



NE Neill September 2, 2020 02:42 PM UTC

Hi,

I also needed to add a reference to ej2.min.js such as:

I added to _Layout.cshtml:

    @Scripts.Render("https://cdn.syncfusion.com/ej2/18.2.54/dist/ej2.min.js")

It now seems to be working, I will run more tests.

Many thanks,

Neill


AR Aravind Ravi Syncfusion Team September 3, 2020 03:49 AM UTC

Hi Neil, 
 
Thanks for the update 
 
Regards 
Aravind Ravi 


Loader.
Up arrow icon