问题描述
- asp.net中gridview的内置删除事件为什么不能弹出js提示
-
如下,当删除失败之后,后面输出的js不能弹出来protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Button button = GridView1.Rows[e.RowIndex].FindControl("Button1") as Button; int albumId = Convert.ToInt32(button.CommandArgument); int aa = new PhotoManager().deletePhoto(0, albumId) ; //先删照片, if (new PhotoManager().getPhoto(albumId).Count <= 0) //再判断照片是否已全部删除 { if (new AlbumManager().deleteAlbum(albumId) > 0) //最后 删除相册 { getAlbumWeb(); } else { Response.Write("<script>alert('网络忙!删除失败')</script>"); } } }
解决方案
Response.Write("<script>alert('网络忙!删除失败')</script>");
这样写肯定是不行的;
参考:http://blog.csdn.net/chopper7278/article/details/2610375
时间: 2024-08-22 14:39:32