protected void ctlCountryGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UserEdit") { int rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; CTID = Convert.ToInt16(ctlCountryGrid.DataKeys[rowIndex].Value); CountryEditor.Initialize(FlagEnum.EditFlag, CTID); CountryEditor.ShowPopUp(); } if (e.CommandName == "UserDelete") { try { int rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; CTID = UIHelper.ParseShort(ctlCountryGrid.DataKeys[rowIndex].Value.ToString()); DbCountry ct = ScgDbQueryProvider.DbCountryQuery.FindByIdentity(CTID); DbCountryService.Delete(ct); } 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); ctlCountryGrid.DataCountAndBind(); } } ctlCountryGrid.DataCountAndBind(); ctlUpdatePanelGridview.Update(); } }
private void button1_Click_1(object sender, EventArgs e) { country c = (country)cbCountry.SelectedItem; if (c != null) { CountryEditor editor = new CountryEditor(db, c); editor.Show(); } }
protected void ctlAddNew_Click(object sender, ImageClickEventArgs e) { CountryEditor.Initialize(FlagEnum.NewFlag, 0); CountryEditor.ShowPopUp(); }
private void RefreshGridData(object sender, EventArgs e) { CountryEditor.HidePopUp(); ctlCountryGrid.DataCountAndBind(); ctlUpdatePanelGridview.Update(); }