自动弹出窗口问题
protected void Button1_Click1(object sender, EventArgs e)
{
string Title = txtTitle.Text;
string Content = this.WebEditor1.Text;
Model model = new Model();
model.Title=Title;
model.Content=Content;
try
{
CatalogDataBase.AddArticle(model);
MessageBox.Show(this, "添加文章成功!");
Response.Redirect("Article_Add.aspx");
}
catch
{
MessageBox.Show(this, "添加文章失败!");
}
}
以下是MessageBox类的代码
public class MessageBox
{
public static void Show(System.Web.UI.Page page, string msg)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>");
}
}
为什么添加失败就能弹出窗口.
而添加成功了却不能弹出添加成功窗口..