protected void Page_Load(object sender, EventArgs e) { RoleUtilities roleUtilities = new RoleUtilities(); OptionUtilities optionUtilities = new OptionUtilities(); if (Request.HttpMethod == "POST") { string roleName = rolename.Value; string groupOption = groupoptions.Value; string roleType = Request.Form["type"]; string roleLink = rolelink.Value; if (!string.IsNullOrEmpty(roleName) || !string.IsNullOrEmpty(groupOption) || !string.IsNullOrEmpty(roleType)) { string result = roleUtilities.InsertRole(roleName, groupOption, roleType, roleLink); if (result == "Success") { ClearFields(); toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("success", $"{roleName} Successfully Added.")); } else { toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"An Error Occured Please Contact System Administrator.")); } } else { toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Please fill up all Fields.")); } } ListItem[] gOptions = optionUtilities.GetGroupOptions(); groupoptions.Items.Clear(); groupoptions.Items.AddRange(gOptions); sgroupoptions.Items.Clear(); sgroupoptions.Items.AddRange(gOptions); editgroupoptions.Items.Clear(); editgroupoptions.Items.AddRange(gOptions); ShowRoles(roleUtilities.GetRoles()); }