using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace AjaxControlToolkitMvc
{
public static class ModelPopupExtensions
{
public static string ModelPopup(this AjaxHelper helper,
string BackgroundCssClass,
string CancelControlID,
string DropShadow,
string OkControlID,
string OnOkScript,
string PopupControlID,
string PopupDragHandleControlID,
string dynamicServicePath,
string id,
string elementId)
{
var sb = new StringBuilder();
// Add Microsoft Ajax library
sb.AppendLine(helper.MicrosoftAjaxLibraryInclude());
// Add toolkit scripts
sb.AppendLine(helper.ToolkitInclude
(
"AjaxControlToolkit.ExtenderBase.BaseScripts.js",
"AjaxControlToolkit.Common.Common.js",
"AjaxControlToolkit.DynamicPopulate.DynamicPopulateBehavior.js",
"AjaxControlToolkit.RoundedCorners.RoundedCornersBehavior.js",
"AjaxControlToolkit.Compat.Timer.Timer.js",
"AjaxControlToolkit.DropShadow.DropShadowBehavior.js",
"AjaxControlToolkit.Compat.DragDrop.DragDropScripts.js",
"AjaxControlToolkit.DragPanel.FloatingBehavior.js",
"AjaxControlToolkit.ModalPopup.ModalPopupBehavior.js"
));
// Perform $create
string properties = "";
properties = string.Format(@"""BackgroundCssClass"": ""{0}"", ""CancelControlID"": ""{1}"", ""DropShadow"": {2}, ""OkControlID"": ""{3}"", ""OnOkScript"": ""{4}"", ""PopupControlID"": ""{5}"", ""PopupDragHandleControlID"": ""{6}"", ""dynamicServicePath"": ""{7}"", ""id"": ""{8}""",
BackgroundCssClass, CancelControlID, DropShadow, OkControlID, OnOkScript, PopupControlID, PopupDragHandleControlID, dynamicServicePath, id);
properties = "{ " + properties + " }";
sb.AppendLine(helper.Create("AjaxControlToolkit.ModalPopupBehavior", properties, elementId));
return sb.ToString();
}
}
}