protected void ctlPB_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex; if (e.CommandName.Equals("PBEdit")) { rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; PBID = UIHelper.ParseShort(ctlPBGrid.DataKeys[rowIndex].Values["Pbid"].ToString()); PBEditor.Initialize(FlagEnum.EditFlag, PBID); PBEditor.ShowPopUp(); } if (e.CommandName.Equals("PBDelete")) { try { rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; PBID = UIHelper.ParseShort(ctlPBGrid.DataKeys[rowIndex].Value.ToString()); Dbpb pb = ScgDbQueryProvider.DbPBQuery.FindByIdentity(PBID); DbPBService.DeletePB(pb); } catch (Exception ex) { if (((System.Data.SqlClient.SqlException)(ex.GetBaseException())).Number == 547) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertInUseData", "alert('This data is now in use.');", true); ctlPBGrid.DataCountAndBind(); } } ctlPBGrid.DataCountAndBind(); ctlPBUpdatePanel.Update(); } }
private void RefreshGridData(object sender, EventArgs e) { PBEditor.HidePopUp(); ctlPBGrid.DataCountAndBind(); ctlPBUpdatePanel.Update(); }
protected void ctlAdd_Click(object sender, ImageClickEventArgs e) { PBEditor.Initialize(FlagEnum.NewFlag, 0); PBEditor.ShowPopUp(); }