protected void gridCategories_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { try { try { CanonCategory.DeleteCategoryById(int.Parse(e.Keys[0].ToString())); } catch (ProductAssignedException pex) { gridCategories.JSProperties["cpDeleteError"] = pex.ProductGroupName; } e.Cancel = true; gridCategories.CancelEdit(); this.BindData(); } catch (Exception ex) { Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error); } }
/// <summary> /// Handler for general callback event (filtering, bulk deleting) /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void clbPanelCategories_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { try { if (string.IsNullOrEmpty(e.Parameter)) { List <object> keyValues = gridCategories.GetSelectedFieldValues("CategoryId"); foreach (object key in keyValues) { CanonCategory.DeleteCategoryById(int.Parse(key.ToString())); } } else if (e.Parameter == "Search") { if (!string.IsNullOrEmpty(txtSearchParam.Text.Trim())) { this.FilterText = txtSearchParam.Text; } this.IsFilterMode = true; } else if (e.Parameter == "ShowAll") { this.IsFilterMode = false; this.FilterText = string.Empty; } this.BindData(); } catch (ProductAssignedException pex) { clbPanelCategories.JSProperties["cpDeleteError"] = pex.ProductGroupName; } catch (Exception ex) { Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error); } }