Click here to Skip to main content
15,891,762 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Unable to use @Html.EJS().Gantt("Gantt") in my project.I add nuget package regarding EJS instead of that this is not working. Will you please help me out.Am unable to use ejs html please help me

What I have tried:

below is the code of web.config
HTML
<configuration>
  <configsections>
    <sectiongroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host">
      <section name="pages">
  <system.web.webpages.razor>
    <host factorytype="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <pages pagebasetype="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc">
        <add namespace="System.Web.Mvc.Ajax">
        <add namespace="System.Web.Mvc.Html">
        <add namespace="System.Web.Routing">
        <add namespace="WebApplication4">
        <add namespace="Syncfusion.EJ2">
        <add namespace="Syncfusion.Mvc.Shared">
        <add namespace="Syncfusion.Mvc.Schedule">
        <add namespace="Syncfusion.Mvc.Tools">
        <add namespace="Syncfusion.JavaScript">
        <add namespace="Syncfusion.MVC.EJ">
  <appsettings>
    <add key="webpages:Enabled" value="false">
  <system.webserver>
    <handlers>
      <remove name="BlockViewHandler">
      <add name="BlockViewHandler" path="*" verb="*" precondition="integratedMode" type="System.Web.HttpNotFoundHandler">
  <system.web>
    <compilation>
      <assemblies>
        <add assembly="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <add assembly="Syncfusion.EJ2, Culture=neutral">

below is my Web.config
HTML
<configuration>
  <configsections>
  <section name="entityFramework">
  <appsettings>
    <add key="webpages:Version" value="3.0.0.0">
    <add key="webpages:Enabled" value="false">
    <add key="ClientValidationEnabled" value="true">
    <add key="UnobtrusiveJavaScriptEnabled" value="true">
  <system.web>
    <compilation debug="true" targetframework="4.7.2">
    <httpruntime targetframework="4.7.2">
  <runtime>
    <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentassembly>
        <assemblyidentity name="System.Web.Helpers" publickeytoken="31bf3856ad364e35">
        <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0">
      <dependentassembly>
        <assemblyidentity name="System.Web.WebPages" publickeytoken="31bf3856ad364e35">
        <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0">
      <dependentassembly>
        <assemblyidentity name="System.Web.Mvc" publickeytoken="31bf3856ad364e35">
        <bindingredirect oldversion="1.0.0.0-5.2.7.0" newversion="5.2.7.0">
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" 
="" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warninglevel="4" compileroptions="/langversion:default /nowarn:1659;1699;1701">
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" 
="" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warninglevel="4" compileroptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+">
  <entityframework>
    <defaultconnectionfactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb">
    <providers>
      <provider invariantname="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer">

below is my cshtml page code
HTML
<p>
    @Html.EJS().Gantt("Gantt").TaskFields(ts =>
ts.Id("Id").Name("Name").StartDate("StartDate").EndDate("EndDate").Duration("Duration")
.Progress("PercentDone").Child("Children").Dependency("Predecessor")).EditSettings(es =>
es.AllowAdding(true).AllowEditing(true).AllowDeleting(true).AllowTaskbarEditing(true)
.ShowDeleteConfirmDialog(true)).Toolbar(new List<string>() 
    { "Add", "Edit", "Update", "Delete", "Cancel", "ExpandAll", "CollapseAll" 
    }).AllowSelection(true).DataSource(ViewBag.datasource).Render()
</p></section></section></section>
Posted
Updated 31-Jan-20 23:44pm
v2
Comments
ZurdoDev 27-Jan-20 10:33am    
You need to check the console in your browser to see what the error is.
Kornfeld Eliyahu Peter 29-Jan-20 10:13am    
What kind of error is 'Unable to use' hides?
Dave Kreskowiak 29-Jan-20 11:23am    
What is "EJS"? It's not part of the .NET Framework or any of the Microsoft libraries.

If you're using a third-party control or graphing package, you're best source of information on how to use it is going to be the vendor of the package.
Kornfeld Eliyahu Peter 30-Jan-20 2:16am    
It is Syncfusion's control library (Essential JS)...

1 solution

Your cshtml code does not look quite like the one showed as example on its support page:
Getting Started | Gantt | ASP.NET MVC | Syncfusion[^].

As last resort, you should ask their support team:
Syncfusion Support Page[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900