Example of Segment in ASP.NET MVC ProgressBar Control
This sample illustrates a circular and linear progress bar to demonstrate rendering with multiple segments.
@Html.UiProgressBar(new UiProgressBarOptions { Id = "sl-container", Value = 100, SegmentCount = 4, ProgressColor = "#ff8c45", Thickness = 10, Label = "Segments" })
@Html.UiProgressBar(new UiProgressBarOptions { Id = "mcls-container", Value = 100, SegmentCount = 5, ProgressColor = "#4940fa", Thickness = 10, Label = "Rounded segments" })
@Html.UiProgressBar(new UiProgressBarOptions { Id = "sc-container", Type = UiProgressType.Circular, Width = "160px", Value = 100, SegmentCount = 4, ProgressColor = "#f429ff", Thickness = 10, Label = "Circular segments" })
@Html.UiProgressBar(new UiProgressBarOptions { Id = "mccs-container", Type = UiProgressType.Circular, Width = "160px", Value = 100, SegmentCount = 5, ProgressColor = "#b52123", Thickness = 10, Label = "Circular rounded segments" })
<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 = "sl-container", Value = 100, SegmentCount = 4, ProgressColor = "#ff8c45", Thickness = 10, Label = "Segments" })
<div style="height: 20px"></div>
@Html.UiProgressBar(new UiProgressBarOptions { Id = "mcls-container", Value = 100, SegmentCount = 5, ProgressColor = "#4940fa", Thickness = 10, Label = "Rounded segments" })
</div>
<div class="pb-row">
<figure>@Html.UiProgressBar(new UiProgressBarOptions { Id = "sc-container", Type = UiProgressType.Circular, Width = "160px", Value = 100, SegmentCount = 4, ProgressColor = "#f429ff", Thickness = 10, Label = "Circular segments" })<figcaption>Segments</figcaption></figure>
<figure>@Html.UiProgressBar(new UiProgressBarOptions { Id = "mccs-container", Type = UiProgressType.Circular, Width = "160px", Value = 100, SegmentCount = 5, ProgressColor = "#b52123", Thickness = 10, Label = "Circular rounded segments" })<figcaption>Rounded segments</figcaption></figure>
</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/Segment.cshtml; it draws what ViewData holds.
public ActionResult Segment()
{
ViewData["color"] = new string[] { "#47a85c", "#0662c4", "#ed61d6", "#edb761" };
ViewData["color1"] = new string[] { "#c0b0f5", "#b39ff5", "#a48cf5", "#8d6ff2", "#7653ed" };
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 progress bar rendering with segments