protected void BtnDelete_Click(object sender, EventArgs e) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); try { if (!(objInterest.DeleteInterest(Session[RunningCache.InterestID].ToString()))) { if (this.global_success.Visible) { this.global_success.Visible = false; } this.global_error.Visible = true; this.global_error_msg.Text = Mains.Constant.FAIL_CRUD; upDel.Update(); bindgrid(Session[RunningCache.InterestID].ToString()); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#deleteModal').modal('hide');"); sb.Append(@"</script>"); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "delHideModalScript", sb.ToString(), false); return; } else { if (this.global_error.Visible) { this.global_error.Visible = false; } this.global_success.Visible = true; this.global_success_msg.Text = Mains.Constant.SUCCESS_DELETE; upDel.Update(); bindgrid(Session[RunningCache.InterestID].ToString()); } } catch (Exception ex) { } sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#deleteModal').modal('hide');"); sb.Append(@"</script>"); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "delHideModalScript", sb.ToString(), false); }
protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e) { try { int index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize; string HDnID = ((HiddenField)EntGridView.Rows[index].FindControl("InterestID")).Value; string SectorInterestName = ((Label)EntGridView.Rows[index].FindControl("SectorInterestName")).Text; string AreaInterestName = ((Label)EntGridView.Rows[index].FindControl("AreaInterestName")).Text; Session[RunningCache.InterestID] = HDnID; if (e.CommandName.Equals("view")) { try { bindSectorInterest(); bindAreaInterest(); DataTable dtInterest = objInterest.GetInterest(" where InterestID='" + HDnID + "'"); ddlSectorInterest1.SelectedValue = dtInterest.Rows[0]["InterestSector"].ToString(); ddlAreaInterest1.SelectedValue = dtInterest.Rows[0]["InterestArea"].ToString(); BtnSave.Text = "Update"; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#addEdiModal').modal('show');"); sb.Append(@"</script>"); ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false); upEdit.Update(); } catch (Exception ex) { } } if (e.CommandName.Equals("deleting")) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); try { if (!(objInterest.DeleteInterest(Session[RunningCache.InterestID].ToString()))) { if (this.global_success.Visible) { this.global_success.Visible = false; } this.global_error.Visible = true; this.global_error_msg.Text = Mains.Constant.FAIL_CRUD; UpdAdd.Update(); upCrudGrid.Update(); upDel.Update(); bindgrid(); return; } else { if (this.global_error.Visible) { this.global_error.Visible = false; } this.global_success.Visible = true; this.global_success_msg.Text = Mains.Constant.SUCCESS_DELETE; UpdAdd.Update(); upDel.Update(); upCrudGrid.Update(); bindgrid(); } } catch (Exception ex) { } } } catch (Exception ex) { } }