protected void saveButton_Click(object sender, EventArgs e) { AppMenuBLL appMenu = new AppMenuBLL(); try { if (menuGroupNameTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Group 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 (menuTypeDropDownList.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu Type field is required."; } else if (menuForAppDropDownList.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Menu For App. field is required."; } else { appMenu.MenuGroupName = menuGroupNameTextBox.Text.Trim(); appMenu.DisplayName = displayNameTextBox.Text.Trim(); appMenu.ToolTipDescription = descriptionTextBox.Text.Trim(); appMenu.URL = urlTextBox.Text.Trim(); appMenu.MenuType = menuTypeDropDownList.SelectedValue.Trim(); appMenu.MenuForApp = menuForAppDropDownList.SelectedValue.Trim(); appMenu.MenuTarget = menuTargetDropDownList.SelectedValue.Trim(); appMenu.ImageUrl = imageURLTextBox.Text.Trim(); if (!appMenu.CheckDuplicateMenuGroup(appMenu.MenuGroupName)) { DataTable dt = appMenu.SaveMenuGroup(); if (dt.Rows.Count > 0) { MyAlertBox("alert(\"Menu Group Created Successfully with Menu Group ID: " + dt.Rows[0][0].ToString() + " \"); window.location=\"/UI/AppMenu/MenuGroupList.aspx\""); } else { msgbox.Visible = true; msgTitleLabel.Text = "Failed to Create Menu Group!!!"; msgDetailLabel.Text = ""; } } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Duplicate!!!"; msgDetailLabel.Text = "This Menu Group already exist, try another one."; } } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { appMenu = null; } }