protected void updateButton_Click(object sender, EventArgs e) { AppMenuBLL appMenu = new AppMenuBLL(); try { if (menuNameTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Name field is required."; } else if (displayNameTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Display Name field is required."; } else if (urlTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu URL field is required."; } else if (menuForAppDropDownList.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required."; } else if (menuTypeDropDownList.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required."; } else if (menuGroupDropDownList.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Group field is required."; } else if (menuLevelDropDownList.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Level field is required."; } else if (parentMenuDropDownList.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Parent Menu field is required."; } else { appMenu.MenuId = idLabel.Text.Trim(); appMenu.MenuName = menuNameTextBox.Text.Trim(); appMenu.DisplayName = displayNameTextBox.Text.Trim(); appMenu.ToolTipDescription = descriptionTextBox.Text.Trim(); appMenu.URL = urlTextBox.Text.Trim(); appMenu.MenuForApp = menuForAppDropDownList.SelectedValue.Trim(); appMenu.MenuType = menuTypeDropDownList.SelectedValue.Trim(); appMenu.MenuGroupId = menuGroupDropDownList.SelectedValue.Trim(); appMenu.IsDisplay = menuDisplayDropDownList.SelectedValue.Trim(); appMenu.MenuLevel = menuLevelDropDownList.SelectedValue.Trim(); appMenu.ParentMenuId = parentMenuDropDownList.SelectedValue.Trim(); appMenu.IsDefault = menuDefaultDropDownList.SelectedValue.Trim(); appMenu.IsSubParent = subParentMenuDropDownList.SelectedValue.Trim(); appMenu.MenuTarget = menuTargetDropDownList.SelectedValue.Trim(); appMenu.ImageUrl = imageURLTextBox.Text.Trim(); if (!appMenu.CheckDuplicateMenu(menuNameTextBox.Text.Trim())) { appMenu.UpdateMenu(); appMenuIdForUpdateHiddenField.Value = ""; appMenuNameHiddenField.Value = ""; MyAlertBox("alert(\"Menu Updated Successfully.\"); window.location=\"/UI/AppMenu/MenuList.aspx\""); } else { if (appMenuNameHiddenField.Value == menuNameTextBox.Text.Trim()) { appMenu.MenuName = "WithOut"; appMenu.UpdateMenu(); appMenuIdForUpdateHiddenField.Value = ""; appMenuNameHiddenField.Value = ""; MyAlertBox("alert(\"Menu Updated Successfully.\"); window.location=\"/UI/AppMenu/MenuList.aspx\""); } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This Menu already exist, try another one."; } } } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { appMenu = null; } }