Example of Default Functionalities in ASP.NET MVC Dialog Control
This example demonstrates the default rendering of the dialog control with minimum configuration. Click close or press ESC to close the dialog. Click “open” to show the dialog again, if it is closed.
About SYNCFUSION Succinctly Series
In the Succinctly series, Syncfusion created a robust, free library of more than 130 technical e - books formatted for PDF, Kindle, and EPUB.The Succinctly series was born in 2012 out of a desire to provide concise technical e-books for software developers.Each title in the Succinctly series is written by a carefully chosen expert and provides essential content in about 100 pages.
@Html.UiButton(new UiButtonOptions { Id = "normalbtn", Text = "Open" })
@Html.UiDialog(new UiDialogOptions
{
Id = "defaultDialog", Target = "target", Header = "About SYNCFUSION Succinctly Series", Content = "In the Succinctly series, Syncfusion created a robust, free library of more than 130 technical e - books formatted for PDF, Kindle, and EPUB.The Succinctly series was born in 2012 out of a desire to provide concise technical e-books for software developers.Each title in the Succinctly series is written by a carefully chosen expert and provides essential content in about 100 pages.",
ShowCloseIcon = true, CloseOnEscape = true, Width = "500px", Animation = UiDialogAnimation.None, OnOpen = "dialogOpen", OnClose = "dialogClose",
Buttons = (List<UiDialogButton>)ViewData["DefaultButtons"]
})
<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; }
</style>
<div id="target" class="control-section">
@Html.UiButton(new UiButtonOptions { Id = "normalbtn", Text = "Open" })
@Html.UiDialog(new UiDialogOptions
{
Id = "defaultDialog", Target = "target", Header = "About SYNCFUSION Succinctly Series", Content = "In the Succinctly series, Syncfusion created a robust, free library of more than 130 technical e - books formatted for PDF, Kindle, and EPUB.The Succinctly series was born in 2012 out of a desire to provide concise technical e-books for software developers.Each title in the Succinctly series is written by a carefully chosen expert and provides essential content in about 100 pages.",
ShowCloseIcon = true, CloseOnEscape = true, Width = "500px", Animation = UiDialogAnimation.None, OnOpen = "dialogOpen", OnClose = "dialogClose",
Buttons = (List<UiDialogButton>)ViewData["DefaultButtons"]
})
</div>
<script>
// Syncfusion: the Open button is hidden while the dialog is open
function dialogOpen() { document.getElementById('normalbtn').style.display = 'none'; }
function dialogClose() { document.getElementById('normalbtn').style.display = 'inline-block'; }
document.addEventListener('click', function (e) { if (e.target.closest('#normalbtn')) { window.Lumen.get("defaultDialog").show(); } });
</script>
<script>
// Syncfusion: the Learn More button opens the Syncfusion page
function dlgButtonClick() { window.open('https://www.syncfusion.com/company/about-us'); }
</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/DefaultFunctionalities.cshtml; it draws what ViewData holds.
public ActionResult DefaultFunctionalities()
{
ViewData["DefaultButtons"] = new List<UiDialogButton>
{
new UiDialogButton { Text = "Learn More", IsPrimary = true, OnClick = "dlgButtonClick", CloseDialog = false }
};
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 dialog control is used to display information and get input from the user. The dialog control is classified as modal and non-modal dialog depend on its interaction with parent application.
- Modal - It creates overlay that disable interaction with the parent application, and user should respond with modal before continuing with other applications.
- Non-modal - It does not prevent user interaction with parent application.