Getting Started with ASP.NET Core ListView Control
23 Jul 20263 minutes to read
This section briefly explains how to include ASP.NET Core ListView control in your ASP.NET Core application using Visual Studio.
Create ASP.NET Core web application with Razor pages
Create an ASP.NET Core Web App using Visual Studio via Microsoft Templates or the ASP.NET Core Extension. For detailed instructions, refer to the ASP.NET Core Web App Getting Started documentation.
Install ASP.NET Core package in the application
To add ASP.NET Core ListView control in the app, open the NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), search and install the Syncfusion.AspNetCore.Lists and Syncfusion.AspNetCore.Themes packages. All Syncfusion ASP.NET Core packages are available in nuget.org. See the NuGet packages topic for details.
Alternatively, you can install the same package using the Package Manager Console with the following command.
Install-Package Syncfusion.AspNetCore.Lists -Version 34.1.29
Install-Package Syncfusion.AspNetCore.Themes -Version 34.1.29Add the ASP.NET Core Tag Helper
After the packages are installed, open the ~/Pages/_ViewImports.cshtml file and import the Syncfusion.AspNetCore.Base and Syncfusion.AspNetCore.Lists Tag Helpers.
@addTagHelper *, Syncfusion.AspNetCore.Base
@addTagHelper *, Syncfusion.AspNetCore.ListsAdd stylesheet and script resources
The theme stylesheet and script can be referenced from NuGet through Static Web Assets. Include the stylesheet and script references inside the <head> of ~/Pages/Shared/_Layout.cshtml file.
<head>
...
<link rel="stylesheet" href="_content/Syncfusion.AspNetCore.Themes/styles/fluent2.css" />
<script src="_content/Syncfusion.AspNetCore.Lists/scripts/sf-list-view.min.js"></script>
</head>Register the Script Manager
Open the ~/Pages/Shared/_Layout.cshtml file and register the script manager <ejs-scripts> at the end of the <body> element as follows.
<body>
...
<!-- Syncfusion ASP.NET Core Script Manager -->
<ejs-scripts></ejs-scripts>
</body>Add ASP.NET Core ListView control
Add the ASP.NET Core ListView control in the ~/Pages/Index.cshtml page.
@* ListView with Empty DataSource *@
<ejs-listview id="list"></ejs-listview>Bind dataSource
After initialization, populate the ListView with data using the dataSource property. Here, the JSON values are passed to the ListView control.
The following example shows a basic ListView.
@{
List<ListViewData> data = new List<ListViewData>();
data.Add(new ListViewData() { text = "Artwork", id = "01" });
data.Add(new ListViewData() { text = "Abstract", id = "02" });
data.Add(new ListViewData() { text = "Modern Painting", id = "03" });
data.Add(new ListViewData() { text = "Ceramics", id = "04" });
data.Add(new ListViewData() { text = "Animation Art", id = "05" });
data.Add(new ListViewData() { text = "Oil Painting", id = "06" });
}
<ejs-listview id="list" dataSource="data"></ejs-listview>public class ListViewData
{
public string text { get; set; }
public string id { get; set; }
}Run the application
Press Ctrl+F5 (Windows) or ⌘+F5 (macOS) to run the app. The ASP.NET Core ListView will render in your default web browser.

NOTE