Getting Started with ASP.NET Core Badge Control

23 Jul 20262 minutes to read

This section briefly explains how to include the ASP.NET Core Badge control in an ASP.NET Core application using Visual Studio.

Create an ASP.NET Core Web App with Razor Pages

Create an ASP.NET Core Web App using Visual Studio via Microsoft Templates or the Syncfusion® ASP.NET Core Extension. For detailed instructions, refer to the ASP.NET Core Web App Getting Started documentation.

Install the required ASP.NET Core package

To add the ASP.NET Core Badge control in the app, open the NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), search for and install the Syncfusion.AspNetCore.Themes package. All Syncfusion ASP.NET Core packages are available in nuget.org. See the NuGet packages topic for details.

Alternatively, you can install the same packages using the Package Manager Console with the following command.

Install-Package Syncfusion.AspNetCore.Themes -Version 34.1.29

Add stylesheet

The theme stylesheet can be referenced from Static Web Assets. Include the stylesheet inside the <head> of ~/Pages/Shared/_Layout.cshtml.

<head>
    ...
    <!-- Syncfusion ASP.NET Core controls styles -->
    <link rel="stylesheet" href="_content/Syncfusion.AspNetCore.Themes/styles/fluent2.css" />
</head>

Add ASP.NET Core Badge Control

Add the ASP.NET Core Badge control in the ~/Pages/Index.cshtml file.

<div id='element'>
    <h1>Badge Component <span class="e-badge e-badge-primary">New</span></h1>
</div>
<style>
    #element {
        display: flex;
        width: 400px;
        margin: auto;
        border: 1px solid #dddddd;
        border-radius: 3px;
        justify-content: center;
    }
</style>

Run the application

Press Ctrl+F5 (Windows) or +F5 (macOS) to launch the application. The ASP.NET Core Badge will render in your default web browser.

ASP.NET Core Badge Control

NOTE

View Sample in GitHub.

See also