Example of Vertical Orientation in ASP.NET MVC Slider Control
This sample demonstrates the rendering of Slider component in Vertical orientation. Drag the thumb over the bar for selecting the values between min and max.
Ticks
Tooltip
@Html.UiSlider("default", new UiSliderOptions { Orientation = UiSliderOrientation.Vertical, Height = "250px", Min = 0, Max = 100, Value = 30, Ticks = new UiSliderTicks { Placement = UiSliderPlacement.Before, LargeStep = 20, SmallStep = 5, ShowSmallTicks = true }, Tooltip = new UiSliderTooltip { IsVisible = true, Placement = UiSliderPlacement.After, ShowOn = UiSliderTooltipShowOn.Always } })
@Html.UiSlider("minrange", new UiSliderOptions { Orientation = UiSliderOrientation.Vertical, Height = "250px", Min = 0, Max = 100, Value = 30, Type = UiSliderType.MinRange, Ticks = new UiSliderTicks { Placement = UiSliderPlacement.Before, LargeStep = 20, SmallStep = 5, ShowSmallTicks = true }, Tooltip = new UiSliderTooltip { IsVisible = true, Placement = UiSliderPlacement.After, ShowOn = UiSliderTooltipShowOn.Always } })
@Html.UiSlider("range", new UiSliderOptions { Orientation = UiSliderOrientation.Vertical, Height = "250px", Min = 0, Max = 100, Values = (double[])ViewData["sliderValue"], Type = UiSliderType.Range, Ticks = new UiSliderTicks { Placement = UiSliderPlacement.Before, LargeStep = 20, SmallStep = 5, ShowSmallTicks = true }, Tooltip = new UiSliderTooltip { IsVisible = true, Placement = UiSliderPlacement.After, ShowOn = UiSliderTooltipShowOn.Always } })
@Html.UiCheckBox("ticks", true, new UiCheckBoxOptions { Id = "ticks", OnChange = "ticksChange" })
@Html.UiCheckBox("tooltip", true, new UiCheckBoxOptions { Id = "tooltip", OnChange = "tooltipChange" })
<style>
.control-section .control-wrapper { width: 80%; margin: 0 auto; min-width: 185px; }
.sliderwrap { margin-top: 40px; }
.sliderwrap label, .slider-labeltext { display: block; padding-bottom: 14px; font-size: 13px; font-weight: 500; user-select: none; }
.property-section .property-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.slider_table td { padding: 0 40px; vertical-align: top; }
</style>
<div class="control-section">
<div class="control-wrapper">
<table class="slider_table">
<tr>
<td><div class="sliderwrap">@Html.UiSlider("default", new UiSliderOptions { Orientation = UiSliderOrientation.Vertical, Height = "250px", Min = 0, Max = 100, Value = 30, Ticks = new UiSliderTicks { Placement = UiSliderPlacement.Before, LargeStep = 20, SmallStep = 5, ShowSmallTicks = true }, Tooltip = new UiSliderTooltip { IsVisible = true, Placement = UiSliderPlacement.After, ShowOn = UiSliderTooltipShowOn.Always } })</div></td>
<td><div class="sliderwrap">@Html.UiSlider("minrange", new UiSliderOptions { Orientation = UiSliderOrientation.Vertical, Height = "250px", Min = 0, Max = 100, Value = 30, Type = UiSliderType.MinRange, Ticks = new UiSliderTicks { Placement = UiSliderPlacement.Before, LargeStep = 20, SmallStep = 5, ShowSmallTicks = true }, Tooltip = new UiSliderTooltip { IsVisible = true, Placement = UiSliderPlacement.After, ShowOn = UiSliderTooltipShowOn.Always } })</div></td>
<td><div class="sliderwrap">@Html.UiSlider("range", new UiSliderOptions { Orientation = UiSliderOrientation.Vertical, Height = "250px", Min = 0, Max = 100, Values = (double[])ViewData["sliderValue"], Type = UiSliderType.Range, Ticks = new UiSliderTicks { Placement = UiSliderPlacement.Before, LargeStep = 20, SmallStep = 5, ShowSmallTicks = true }, Tooltip = new UiSliderTooltip { IsVisible = true, Placement = UiSliderPlacement.After, ShowOn = UiSliderTooltipShowOn.Always } })</div></td>
</tr>
</table>
</div>
</div>
<div class="demo-property-panel property-section" title="Properties">
<div class="property-row"><span>Ticks</span> @Html.UiCheckBox("ticks", true, new UiCheckBoxOptions { Id = "ticks", OnChange = "ticksChange" })</div>
<div class="property-row"><span>Tooltip</span> @Html.UiCheckBox("tooltip", true, new UiCheckBoxOptions { Id = "tooltip", OnChange = "tooltipChange" })</div>
</div>
<script>
// Syncfusion: the check boxes show or hide the ticks and the tooltips of the vertical sliders
function sliders() { return ['default', 'minrange', 'range'].map(function (id) { return window.Lumen.get(id); }); }
function ticksChange(checked) { sliders().forEach(function (s) { s.setTicks({ placement: checked ? 'Before' : 'None' }); }); }
function tooltipChange(checked) { sliders().forEach(function (s) { s.setTooltip({ visible: checked }); }); }
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class RangeSliderController : Controller
{
// The page is Views/RangeSlider/Orientation.cshtml; it draws what ViewData holds.
public ActionResult Orientation()
{
ViewData["sliderValue"] = new double[] { 30, 70 };
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>
The Slider component can be rendered in either horizontal or vertical orientation and this can be set through the orientation property
The Slider component allows the user to select a value or range of values in-between a min and max range, by dragging the thumb over the slider bar in Vertical orientation. There are three types of sliders available in Vertical Orientation:
- Default - allows us to select a single value in Vertical Orientation
- MinRange – allows us to select a single value, but highlights with a range selection from the min value to the current handle value in Vertical Orientation
- Range – allows us to select a range of values with two handles, where the handles was connected with a range selection in Vertical Orientation
- Reverse – allows to render the component in reverse order. To utilise this, set the maximum value to the Min property and set the minimum value to the Max property
The dragInterval is used to drag both handles using the range bar which is also applicable only to the range slider.
In this demo we can see the Default, MinRange and Range slider types.