Search results

Getting started with ASP.NET MVC Range Navigator control

20 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 MVC application, need to ensure the following software to be installed on the machine.

  1. .Net Framework 4.5 and above.
  3. Visual Studio

Preparing ASP.NET MVC application

The following steps to create ASP.NET MVC Application.

Step 1: Create ASP.NET MVC Application with default template project in Visual Studio.

Default Template

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

Open the NuGet package manager.

Solution Explorer

Install the Syncfusion.EJ2.MVC4 package to the application.

Nuget Demo

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

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

Step 3: Add Syncfusion.EJ2 namespace reference in Web.config

Copied to clipboard
<add namespace="Syncfusion.EJ2"/>
Copied to clipboard
    <add assembly="Syncfusion.EJ2" Version=15.3400.0.27, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Step 4: Add client side resource through CDN or local package in the layout page _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 _Layout.cshtml.

Copied to clipboard

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

Copied to clipboard

Populate range navigator with data

Now, we are going to provide data to the range navigator. Add a series object to the range navigator by using series property. Now map the field names x and y in the JSON data to the xName and yNameproperties of the series, then set the JSON data to dataSource property. Since the JSON contains Datetime data, set the valueType as DateTime. By default, the axis valueType is Numeric.

Copied to clipboard
                .Series(sr =>
Copied to clipboard
public IActionResult Index()
        List <data> dataSource = new List<data>
                new data { x = new DateTime(2005, 01, 01), y = 21, y1 = 28 },
                new data { x = new DateTime(2006, 01, 01), y = 24, y1 = 44 },
                new data { x = new DateTime(2007, 01, 01), y = 36, y1 = 48 },
                new data { x = new DateTime(2008, 01, 01), y = 38, y1 = 50 },
                new data { x = new DateTime(2009, 01, 01), y = 54, y1 = 66 },
                new data { x = new DateTime(2010, 01, 01), y = 57, y1 = 78 },
                new data { x = new DateTime(2011, 01, 01), y = 70, y1 = 84 },
            ViewBag.dataSource = dataSource;
            return View();
       public class data
            public DateTime x;
            public double y;
            public double y1;