Example of RTL in ASP.NET MVC Dialog Control
This sample demonstrates the RTL mode of Dialog component, that displays content from right-to-left direction. Click on “Open” button to show the Dialog again if it is closed.
Delete Files
Are you sure you want to delete sea.jpg?
@Html.UiButton(new UiButtonOptions { Id = "dialogButton", Text = "OPEN" })
@Html.UiDialog(new UiDialogOptions
{
Id = "RTL_dialog", Target = "target", Header = "Delete Files", Content = "Are you sure you want to delete sea.jpg?", ShowCloseIcon = true, CloseOnEscape = false, Width = "300px",
Animation = UiDialogAnimation.Zoom, OnOpen = "dialogOpen", OnClose = "dialogClose",
Buttons = { new UiDialogButton { Text = "Yes", IsPrimary = true }, new UiDialogButton { Text = "No" } }
})
<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 class="control-section" id="target" dir="rtl">
@Html.UiButton(new UiButtonOptions { Id = "dialogButton", Text = "OPEN" })
@Html.UiDialog(new UiDialogOptions
{
Id = "RTL_dialog", Target = "target", Header = "Delete Files", Content = "Are you sure you want to delete sea.jpg?", ShowCloseIcon = true, CloseOnEscape = false, Width = "300px",
Animation = UiDialogAnimation.Zoom, OnOpen = "dialogOpen", OnClose = "dialogClose",
Buttons = { new UiDialogButton { Text = "Yes", IsPrimary = true }, new UiDialogButton { Text = "No" } }
})
</div>
<script>
// Syncfusion: the Open button is hidden while the dialog is open
function dialogOpen() { document.getElementById('dialogButton').style.display = 'none'; }
function dialogClose() { document.getElementById('dialogButton').style.display = 'inline-block'; }
document.addEventListener('click', function (e) { if (e.target.closest('#dialogButton')) { window.Lumen.get("RTL_dialog").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/RTL.cshtml; it draws what ViewData holds.
public ActionResult RTL()
{
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>
This sample is rendered with English language, and written from right-to-left. To enable this RTL support in Dialog, set the enableRTL property as true.