62,047
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 显示消息
/// </summary>
/// <param name="message">消息内容</param>
public void ShowMessage(string message)
{
message = message.Replace("'", "").Replace("\"", "")
.Replace("{", "(").Replace("}", ")").Replace("\n", "");
string strFormat = "<script>javascript:alert('{0}')</script>";
Response.Write(String.Format(strFormat, message));
}
/// <summary>
/// 显示消息,用于使用UpdatePanel的情况
/// </summary>
/// <param name="message">消息内容</param>
public void AJAXShowMessage(string message)
{
message = message.Replace("'", "").Replace("\"", "")
.Replace("{", "(").Replace("}", ")").Replace("\n", "");
string strFormat = "alert('{0}')";
strFormat = String.Format(strFormat, message);
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString("N").Substring(1, 4), strFormat, true);
}