Example of Custom Resize functionality in ASP.NET MVC MultiSelect Control
This example demonstrates the custom resizing functionalities of the MultiSelect. You can adjust the size of the popup based on your preferences, allowing for better control over its appearance.
@Html.UiMultiSelect("country", new UiMultiSelectOptions
{
Placeholder = "Select a country",
AllowResize = true,
DataSource = (IEnumerable<DropdownsDemoController.CountriesData>)ViewData["data"],
Fields = new UiDropDownFields { Text = "Name", Value = "Code" }
})
<style>
.control-wrapper { margin: 0 auto; width: 250px; }
</style>
@using Lumen.UI.Mvc.Demo.Controllers
<div class="control-section" style="height: 400px;">
<div class="control-wrapper">
<div style="padding-top:75px;">
@Html.UiMultiSelect("country", new UiMultiSelectOptions
{
Placeholder = "Select a country",
AllowResize = true,
DataSource = (IEnumerable<DropdownsDemoController.CountriesData>)ViewData["data"],
Fields = new UiDropDownFields { Text = "Name", Value = "Code" }
})
</div>
</div>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class MultiSelectController : Controller
{
// The page is Views/MultiSelect/Resize.cshtml; it draws what ViewData holds.
public ActionResult Resize()
{
ViewData["data"] = new CountriesData().CountriesList();
ViewData["query"] = "new ej.data.Query()";
return View();
}
public class CountriesData
{
public string Name { get; set; }
public string Code { get; set; }
public List<CountriesData> CountriesList()
{
List<CountriesData> country = new List<CountriesData>();
country.Add(new CountriesData { Name = "Australia", Code = "AU" });
country.Add(new CountriesData { Name = "Bermuda", Code = "BM" });
country.Add(new CountriesData { Name = "Canada", Code = "CA" });
// ... 16 more rows
return country;
}
}
}
}
@* 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 MultiSelect can be customized to adjust the size of the popup using custom resizing functionalities. By setting AllowResize to true, you enable the ability to resize the popup, allowing you to control its dimensions according to your preferences and providing better management of its appearance.