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.DeleteMenuGroupById(menuGroupListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False"); if (status == "Deleted") { MyAlertBox("alert(\"Menu Group Deleted Successfully.\"); window.location=\"/UI/AppMenu/MenuGroupList.aspx\""); } else { MyAlertBox("alert(\"This Menu Group contains " + status + " child(s). You can't delete this Menu Group. You must move the child(s) first to another menu group.\"); window.location=\"/UI/AppMenu/MenuGroupList.aspx\""); } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } }