Search results

Getting Started with ASP.NET Core

18 Jan 2022 / 2 minutes to read

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to include a license key in your projects. Please refer to this link to know about registering Syncfusion license key in your ASP.NET Core application to use our components.


To get start with ASP.NET Core application, need to ensure the following software to be installed on the machine.

  • Visual Studio 2017
  • DotNet Core 2.0

Setup ASP.NET Core application with Essential JS 2 for ASP.NET Core

The following steps to create ASP.NET Core Application.

Step 1: Create ASP.NET Core Web Application with default template project in Visual Studio 2017.

Alt text

Step 2: Once your project created. We need to add Syncfusion EJ2 package into your application by using Nugget Package Manager.

Open the nuGet package manager.

Alt text

Install the Syncfusion.EJ2 package to the application

Alt text

After Installation complete this will included in the project. You can refer it from the Project Assembly Reference.

We need to install NewtonSoft.JSON as dependency since it Syncfusion.EJ2 dependent to NewtonSoft.JSON package.

Step 3: Open the Views/_ViewImports.cshtml to import Syncfusion.EJ2 package.

Copied to clipboard
@addTagHelper *, Syncfusion.EJ2

Step 4: Add client side resource through CDN or local package in the layout page Views/Shared/_Layout.cshtml.

Copied to clipboard
@* Syncfusion Essential JS 2 Styles *@
<link rel="stylesheet" href="" />

@* Syncfusion Essential JS 2 Scripts *@
<script src=""></script>

Step 5: Adding Script Manager in layout page Views/Shared/_Layout.cshtml.

Copied to clipboard
@RenderSection("Scripts", required: false)

Step 6: Add the below code to your Index.cshtml view page which is present under Views/Home folder, to initialize the Accumulationchart.

Copied to clipboard
<ejs-accumulationchart id="container" title="Mobile Browser Statistics">
        <e-accumulationchart-legendsettings visible="false">
            <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">

Pie Series

By default, the pie series will be rendered when assigning the JSON data to the series using the dataSource property. Map the field names in the JSON data to the xName and yName properties of the series.

Copied to clipboard
@Html.EJS().AccumulationChart("container").Title("Mobile Browser Statistics")
                                      .LegendSettings(ls => ls.Visible(false)).EnableSmartLabels(true).
                                      Series(series =>
                                          series.DataLabel(dl => dl.Visible(true).Name("text"))
Copied to clipboard
public ActionResult Index()
           List<PieChartData> chartData = new List<PieChartData>

                new PieChartData { xValue = "Chrome", yValue = 37, text = "37%", fill="#498fff"},
                new PieChartData { xValue = "UC Browser", yValue = 17, text = "17%", fill="#ffa060"},
                new PieChartData { xValue = "iPhone", yValue = 19, text = "19%", fill="#ff68b6"},
                new PieChartData { xValue = "Others", yValue = 4 , text = "4%", fill="#81e2a1"},
            ViewBag.dataSource = chartData;
             return View();
         public class PieChartData
            public string xValue;
            public double yValue;
            public string text;
            public string fill;

Alt text