|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.WebPages;
using NovelTheory.Component;
namespace JSHelperDemo.Components
{
public static class MyHelpers
{
public static MvcHtmlString MessageBox(this HtmlHelper html, string id,
string Text, string title = "Error", string icon = "info")
{
var text = string.Format(@"<div id=""{0}"" title=""{1}""> " +
@"<p><span class=""ui-icon ui-icon-{2}"" style=""float:left; margin:0 7px 20px 0;"">" +
@"</span>{3}</p></div>",
id, title, icon, Text);
var script = JavascriptHelper.Create(WebPageContext.Current);
script.Std("dialog");
script.AddOnReadyScript(@"$('#" + id + "').dialog({ autoOpen: false });");
script.AddScript("MessageBox", "function OpenDiag(id){$('#'+id).dialog('open');}");
return new MvcHtmlString(text);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
20+ years as a developer : Assembly, C, C++ and C# (in that order) with sidelines in ASP/VBScript, ASP.Net, JavaScript, Perl, QuickBasic, VisualBasic, plus a few others which I'm not going to mention because if I did someone might ask me to use them again (shudder)
Microsoft MVP in VC++ (1994-2004)
I also run www.NJTheater.com as a hobby.
Full resume & stuff at NovelTheory.com
Underused blog at HonestIllusion.com