简单的封装一个HTML 弹出对话框的空间
代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace sjn
{
/// <summary>
///MessageBox 的摘要说明
/// </summary>
public sealed class MessageBox : WebControl
{
private bool _show = false;
private string _message = string.Empty;
public void Show(string msg)
{
this._show = true;
this._message = ToJSString(msg);
}
protected override void Render(HtmlTextWriter writer)
{
if (_show)
{
writer.Write("{0}", this._message);
}
}
string ToJSString(string msg)
{
return " <script>alert('" + msg + "') </script>";
}
}
}
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace sjn
{
/// <summary>
///MessageBox 的摘要说明
/// </summary>
public sealed class MessageBox : WebControl
{
private bool _show = false;
private string _message = string.Empty;
public void Show(string msg)
{
this._show = true;
this._message = ToJSString(msg);
}
protected override void Render(HtmlTextWriter writer)
{
if (_show)
{
writer.Write("{0}", this._message);
}
}
string ToJSString(string msg)
{
return " <script>alert('" + msg + "') </script>";
}
}
}