protected void deleteLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; AppMenuBLL appMenu = new AppMenuBLL(); string status = appMenu.DeleteMenuById(menuListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False"); if (status == "Deleted") { MyAlertBox("alert(\"Menu Deleted Successfully.\"); window.location=\"/setting/AppMenu/MenuList.aspx\""); } else { MyAlertBox("alert(\"This Menu used as Sub-Parent Menu which contains " + status + " child(s). You can't delete this Sub-Parent Menu. You must move the child(s) first to another menu.\"); window.location=\"/HRUI/AppMenu/MenuList.aspx\""); } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; msgbox.Attributes.Add("Class", "alert alert-warning"); } }