Example of Labels in ASP.NET MVC ProgressBar Control
This sample illustrates a linear progress bar to demonstrate different types of labels rendering.
@Html.UiProgressBar(new UiProgressBarOptions { Id = "percentage", Value = 40, ShowProgressValue = true, LabelFormat = "{percent}% Complete (Success)", Thickness = 24, Severity = UiSeverity.Success, Label = "{percent}% Complete (Success)" })
@Html.UiProgressBar(new UiProgressBarOptions { Id = "ratio", Value = 50, ShowProgressValue = true, LabelFormat = "{percent}% Complete (Info)", Thickness = 24, Severity = UiSeverity.Info, Label = "{percent}% Complete (Info)" })
@Html.UiProgressBar(new UiProgressBarOptions { Id = "acutal", Value = 70, ShowProgressValue = true, LabelFormat = "{value} of 100 (Warning)", Thickness = 24, Severity = UiSeverity.Warning, Label = "{value} of 100 (Warning)" })
@Html.UiProgressBar(new UiProgressBarOptions { Id = "label-error", Value = 90, ShowProgressValue = true, LabelFormat = "{percent}% Complete (Danger)", Thickness = 24, Severity = UiSeverity.Error, Label = "{percent}% Complete (Danger)" })
<style>
.pb-wrap { max-width: 760px; margin: 0 auto; padding: 20px 0; }
.pb-label { margin: 18px 0 6px; font-size: 14px; font-weight: 500; }
.pb-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px; padding: 20px 0; }
.pb-row figure { margin: 0; text-align: center; }
.pb-row figcaption { margin-top: 8px; font-size: 13px; }
.pb-center { text-align: center; padding: 16px 0; }
.annotaion-pro { font-size: 20px; font-weight: 700; }
</style>
<div class="control-section">
<div class="pb-wrap">
@Html.UiProgressBar(new UiProgressBarOptions { Id = "percentage", Value = 40, ShowProgressValue = true, LabelFormat = "{percent}% Complete (Success)", Thickness = 24, Severity = UiSeverity.Success, Label = "{percent}% Complete (Success)" })
<div style="height: 14px"></div>
@Html.UiProgressBar(new UiProgressBarOptions { Id = "ratio", Value = 50, ShowProgressValue = true, LabelFormat = "{percent}% Complete (Info)", Thickness = 24, Severity = UiSeverity.Info, Label = "{percent}% Complete (Info)" })
<div style="height: 14px"></div>
@Html.UiProgressBar(new UiProgressBarOptions { Id = "acutal", Value = 70, ShowProgressValue = true, LabelFormat = "{value} of 100 (Warning)", Thickness = 24, Severity = UiSeverity.Warning, Label = "{value} of 100 (Warning)" })
<div style="height: 14px"></div>
@Html.UiProgressBar(new UiProgressBarOptions { Id = "label-error", Value = 90, ShowProgressValue = true, LabelFormat = "{percent}% Complete (Danger)", Thickness = 24, Severity = UiSeverity.Error, Label = "{percent}% Complete (Danger)" })
</div>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class ProgressBarController : Controller
{
// The page is Views/ProgressBar/Labels.cshtml; it draws what ViewData holds.
public ActionResult Labels()
{
return View();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
This demo for Essential JS2 Progress Bar control shows the linear progress bar with different labels format with help of LabelStyle and provide different modes using Role property.