Example of Resizable in ASP.NET MVC Dialog Control
This sample demonstrates the resize operation of the dialog control in all directions. To resize the modal dialog, select and resize a dialog using its handle (grip) or hover on any of the edges or border of the dialog within the sample container. The "open dialog" button is used to reopen the dialog if it is closed.
@Html.UiButton(new UiButtonOptions { Id = "dialogBtn", Text = "Open Dialog", CssClass = "dlgbtn" })
@Html.UiDialog(new UiDialogOptions
{
Id = "resizeDialog", Target = "target", Visible = true, EnableResize = true, AllowDragging = true, Header = "Resize Me", Content = "This is a dialog with resizable support.",
ShowCloseIcon = true, CloseOnEscape = true, Width = "300px", Animation = UiDialogAnimation.None, OnOpen = "dialogOpen", OnClose = "dialogClose"
})
<style>
.control-section { padding-left: 10px; }
#target { position: relative; height: 100%; min-height: 350px; }
.dlgbtn { margin-right: 10px; }
.animate { display: inline-block; margin: 0 6px 6px 0; }
#dialogBtn { display: none; }
</style>
<div id="target" class="control-section">
@Html.UiButton(new UiButtonOptions { Id = "dialogBtn", Text = "Open Dialog", CssClass = "dlgbtn" })
@Html.UiDialog(new UiDialogOptions
{
Id = "resizeDialog", Target = "target", Visible = true, EnableResize = true, AllowDragging = true, Header = "Resize Me", Content = "This is a dialog with resizable support.",
ShowCloseIcon = true, CloseOnEscape = true, Width = "300px", Animation = UiDialogAnimation.None, OnOpen = "dialogOpen", OnClose = "dialogClose"
})
</div>
<script>
// Syncfusion: the Open button is hidden while the dialog is open
function dialogOpen() { document.getElementById('dialogBtn').style.display = 'none'; }
function dialogClose() { document.getElementById('dialogBtn').style.display = 'inline-block'; }
document.addEventListener('click', function (e) { if (e.target.closest('#dialogBtn')) { window.Lumen.get("resizeDialog").show(); } });
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class DialogController : Controller
{
// The page is Views/Dialog/Resizable.cshtml; it draws what ViewData holds.
public ActionResult Resizable()
{
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>
Users can create resizable modal dialog by setting the enableResize property to true, which is used to change the size of a dialog dynamically and view its content with expanded mode. The resizeHandles property can also be configured for which directions the dialog should resize. When you configure the target property along with the enableResize property, the dialog can be resized within its specified target container.