kreta/KretaWeb/Helpers/ModalExtensions.cs
2024-03-13 00:33:46 +01:00

30 lines
896 B
C#

using System.Web.Mvc;
using Kendo.Mvc.UI;
using Kendo.Mvc.UI.Fluent;
namespace Kreta.Web.Helpers
{
public static class ModalExtensions
{
public static WindowBuilder KretaWindow(this HtmlHelper helper, string name, string title = "", int width = 0, int height = 0, bool isModal = true
, bool isResizable = true, bool isVisible = false)
{
var window = helper.Kendo().Window()
.Name(name)
.Modal(isModal)
.Resizable()
.Draggable()
.Visible(isVisible)
.Draggable(true)
.Title(title)
.Actions(act => act.Maximize().Close());
if (width > 0)
window = window.Width(width);
if (height > 0)
window = window.Height(height);
return window;
}
}
}