Getting Started with ASP.NET Core Card Control
23 Jul 20264 minutes to read
This section briefly explains how to include ASP.NET Core Card 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 Themes 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.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 package using the Package Manager Console with the following command.
Install-Package Syncfusion.AspNetCore.Themes -Version 34.1.29Add stylesheet
The theme stylesheet can be referenced from NuGet through Static Web Assets. Include the stylesheet inside the <head> of ~/Pages/Shared/_Layout.cshtml file.
<head>
...
<link rel="stylesheet" href="_content/Syncfusion.AspNetCore.Themes/styles/fluent2.css" />
</head>Add ASP.NET Core Card control
Add the ASP.NET Core Card tag helper in ~/Pages/Index.cshtml page.
<div class = "e-card">
Sample Card
</div>Run the application
Press Ctrl+F5 (Windows) or ⌘+F5 (macOS) to launch the application. The ASP.NET Core Card control will render in your default web browser.
Adding a header and content
You can create Card with a header in a specific structure. For adding header you need to create a div element with e-card-header class added.
- You can include heading inside the Card header by adding a
divelement withe-card-header-captionclass, and add content with an element that uses thee-card-contentclass. For detailed information, refer to the Header and Content.
<div class = "e-card"> --> Root Element
<div class="e-card-header"> --> Root Header Element
<div class="e-card-header-caption"> --> Root Heading Element
<div class="e-card-header-title"></div> --> Heading Title Element
</div>
<div class="e-card-content"></div> --> Card content Element
</div>
</div><div tabindex="0" class="e-card" id="basic">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Advanced UWP</div>
</div>
</div>
<div class="e-card-content">
Advanced UWP: Communicating with Windows 10 and Other Apps, the second in a five-part series written by Succinctly series
author Matteo Pagani. To download the complete white paper, and other papers in the series, visit
the White Paper section of Syncfusion’s Technology Resource Portal.
</div>
</div>
NOTE