Example of Rtl in ASP.NET MVC MultiColumnComboBox Control
This example demonstrates the RTL support in the MultiColumn ComboBox.
@Html.UiMultiColumnComboBox("rtl", new UiMultiColumnComboBoxOptions
{
Placeholder = "e.g. The Hobbit",
Fields = new UiDropDownFields { Text = "Title", Value = "Author" },
Columns = new List<UiDropDownColumn>
{
new UiDropDownColumn { Field = "Title", Header = "Title", Width = 200 },
new UiDropDownColumn { Field = "Author", Header = "Author", Width = 150 },
new UiDropDownColumn { Field = "Genre", Header = "Genre", Width = 100 },
new UiDropDownColumn { Field = "PublishedYear", Header = "Published Year", Width = 125 },
new UiDropDownColumn { Field = "Price", Header = "Price", Width = 80 }
},
PopupHeight = "210px",
PopupWidth = "680px",
DataSource = (IEnumerable<DropdownsDemoController.BookDetails>)ViewData["data"]
})
<style>
.control-section .control-wrapper { margin: 0 auto; width: 300px; padding-top: 30px; }
.control-section .control-wrapper label { display: block; margin-bottom: 6px; font-weight: 600; }
</style>
@using Lumen.UI.Mvc.Demo.Controllers
<div class="control-section">
<div class="control-wrapper" dir="rtl">
<label>Select a title</label>
@Html.UiMultiColumnComboBox("rtl", new UiMultiColumnComboBoxOptions
{
Placeholder = "e.g. The Hobbit",
Fields = new UiDropDownFields { Text = "Title", Value = "Author" },
Columns = new List<UiDropDownColumn>
{
new UiDropDownColumn { Field = "Title", Header = "Title", Width = 200 },
new UiDropDownColumn { Field = "Author", Header = "Author", Width = 150 },
new UiDropDownColumn { Field = "Genre", Header = "Genre", Width = 100 },
new UiDropDownColumn { Field = "PublishedYear", Header = "Published Year", Width = 125 },
new UiDropDownColumn { Field = "Price", Header = "Price", Width = 80 }
},
PopupHeight = "210px",
PopupWidth = "680px",
DataSource = (IEnumerable<DropdownsDemoController.BookDetails>)ViewData["data"]
})
</div>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class MultiColumnComboBoxController : Controller
{
// The page is Views/MultiColumnComboBox/RTL.cshtml; it draws what ViewData holds.
public ActionResult RTL()
{
ViewData["data"] = new BookDetails().GetAllRecords();
return View();
}
public class BookDetails
{
public string Title { get; set; }
public string Author { get; set; }
public string Genre { get; set; }
public int PublishedYear { get; set; }
public string Price { get; set; }
public List<BookDetails> GetAllRecords(){
List<BookDetails> books = new List<BookDetails>();
books.Add(new BookDetails { Title = "The Great Adventure", Author = "Emily Thompson", Genre = "Fiction", PublishedYear = 2023, Price = "$12.99" });
books.Add(new BookDetails { Title = "The Clockwork Mirage", Author = "John Doe", Genre = "Non-Fiction", PublishedYear = 2019, Price = "$19.99" });
books.Add(new BookDetails { Title = "Science Explained", Author = "Jane Smith", Genre = "Science", PublishedYear = 2021, Price = "$15.50" });
// ... 12 more rows
return books;
}
}
}
}
@* 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 MultiColumn ComboBox has the support to enable the right-to-left (RTL) text direction when the EnableRtl property is enabled.