protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string message = ""; try { Materials m_Materials = new Materials(); m_Materials.MaterialId = System.Int32.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString()); m_Materials.Delete(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } ShowGrid(); }
protected void lbDelete_Click(object sender, EventArgs e) { try { Materials m_Materials = new Materials(); foreach (GridViewRow m_Row in m_grid.Rows) { CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction"); if (chkAction != null) { if (chkAction.Checked) { m_Materials.MaterialId = System.Int32.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString()); m_Materials.Delete(); } } } ShowGrid(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } }