日期:2014-05-20 浏览次数:20946 次
protected void GridView1_RowDeleting1(object sender, GridViewDeleteEventArgs e) { try { using (var db = new myDataClassesDataContext()) { var name = GridView1.Rows[e.RowIndex].Cells[0].Text; var del = from o in db.MessageTable where o.MessageID == int.Parse(name) select o; foreach (var d in del) { db.MessageTable.DeleteOnSubmit(d); db.SubmitChanges(); this.GridView1.DataBind(); } getdata(); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } }