protected void btnDelete_Click(object sender, EventArgs e) { //创建用户数据表操作类对象 NewsOperate news = new NewsOperate(); string NewsId = Request.QueryString["NewsID"]; //删除用户数据 if (news.DelNews(NewsId)) { Common.ShowMsg("删除成功!"); string newsname = this.txtNewsName.Text.Trim(); string subNewName = newsname; //记录操作员操作 if (newsname.Length > 16) { subNewName = newsname.Substring(0, 16) + "..."; } RecordOperate.SaveRecord(Session["UserID"].ToString(), "系统功能", "删除新闻信息:" + subNewName); ////重新在桌面加载新闻动态 //Response.Write("<script language=javascript>"); //Response.Write("window.top.reload();"); //Response.Write("</script>"); } else { return; } Server.Transfer("System_News_View.aspx"); }
protected void MyDataGrid_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Delete") { //创建用户数据表操作类对象 NewsOperate news = new NewsOperate(); string newsid = ((Label)e.Item.Cells[1].Controls[1]).Text; //删除用户数据 if (news.DelNews(newsid)) { Common.ShowMsg("删除成功!"); string newsname = ((Label)e.Item.Cells[2].Controls[1]).Text; string subNewName = newsname; //记录操作员操作 if (newsname.Length > 16) { subNewName = newsname.Substring(0, 16) + "..."; } RecordOperate.SaveRecord(Session["UserID"].ToString(), "系统功能", "删除新闻信息:" + subNewName); } Server.Transfer("System_News_View.aspx"); } else { string Url = "System_News_Edit.aspx?NewsID=" + ((Label)e.Item.Cells[1].Controls[1]).Text; Server.Transfer(Url); } }