protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string message = ""; try { Units m_Units = new Units(); m_Units.UnitId = System.Int16.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString()); m_Units.Delete(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } ShowGrid(); }
private bool Deleted(int id) { Data objdata = new Data(Global.ConnectionSql); bool ok = false; try { Units obj = new Units(); obj.DataObject = objdata; ok = obj.Delete(id); this.BindingData(); } catch (Exception ex) { Global.WriteLogError("Deleted() " + ex); } finally { objdata.DeConnect(); } return(ok); }
protected void lbDelete_Click(object sender, EventArgs e) { try { Units m_Units = new Units(); foreach (GridViewRow m_Row in m_grid.Rows) { CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction"); if (chkAction != null) { if (chkAction.Checked) { m_Units.UnitId = System.Int16.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString()); m_Units.Delete(); } } } ShowGrid(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } }