void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) { objMaster = new ShuttleZoneBO(); try { objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt()); if (objMaster.Current != null) { objMaster.Delete(objMaster.Current); } } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } e.Cancel = true; } } }
public frmShuttleZones() { InitializeComponent(); objMaster = new ShuttleZoneBO(); this.SetProperties((INavigation)objMaster); this.FormClosing += new FormClosingEventHandler(frmZones_FormClosing); this.Shown += new EventHandler(frmZones_Shown); grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick); grdLister.CommandCellClick += new CommandCellClickEventHandler(grdLister_CommandCellClick); grdLister.RowsChanging += new GridViewCollectionChangingEventHandler(Grid_RowsChanging); LoadAllowedPickups(); FormatGrid(); }