private void Page_Load(object sender, System.EventArgs e) { if (Session["UserID"] == null) { Response.Redirect("../../close_win.aspx"); } baseUtil.keepAlive(this); Session["SelectedPage"] = "BranchManagement"; if (!Page.IsPostBack) { if (Convert.ToInt32(Session["CompanyTypeID"]) == 0) { GetCompanyListForBranch(); GetBranchNameCompanyWiseForHubAdmin(14); } else { RecordSet rs = BranchNL.GetBranchList(System.Convert.ToInt32(Session["CompanyID"])); grdBranch.DataSource = rs.ParentTable; grdBranch.DataBind(); } } }
protected void Datagrid_Click(object source, DataGridCommandEventArgs e) { if (e.CommandName == "DELETERECORD") { lblMessage.Visible = true; if (objCompany.DeleteBranchRecord(Convert.ToInt32(e.CommandArgument))) { lblMessage.Text = "Record(s) deleted successfully."; if (Convert.ToInt32(Session["CompanyTypeID"]) == 0) { GetCompanyListForBranch(); GetBranchNameCompanyWiseForHubAdmin(14); } else { RecordSet rs = BranchNL.GetBranchList(System.Convert.ToInt32(Session["CompanyID"])); grdBranch.DataSource = rs.ParentTable; grdBranch.DataBind(); } } else { lblMessage.Text = "Error deleting branch. References exists in invoice."; } } }