protected void saveButton_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.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(appMenu.MenuName)) { DataTable dt = appMenu.SaveMenu(); if (dt.Rows.Count > 0) { MyAlertBox("alert(\"Menu Created Successfully with Menu ID: " + dt.Rows[0][0].ToString() + " \"); window.location=\"/UI/AppMenu/MenuList.aspx\""); } else { msgbox.Visible = true; msgTitleLabel.Text = "Failed to Create Menu!!!"; msgDetailLabel.Text = ""; } } 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; } }