protected void btnInsert_Click(object sender, EventArgs e) { try { Roles role = new Roles(); bll.Add(role); Response.Write("<script type='text/javascript'>alert('Details Inserted Successfully');</script>"); Response.Redirect("RolesSearch.aspx"); } catch (RolesException ex) { Response.Write("<script type='text/javascript'>alert('" + ex.Message + "');</script>"); } catch (SystemException ex) { Response.Write("<script type='text/javascript'>alert('" + ex.Message + "');</script>"); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { Roles r = new Roles(); r.RoleName = txtRoleName.Text; bll.Add(r); lsSearch.ItemsSource = bll.GetAll(); lsSearch.DisplayMemberPath = "RoleId"; dgRecords.ItemsSource = bll.GetAll(); txtRoleId.Text = bll.GetRoleId().ToString(); ClearWindow(); MessageBox.Show("Role Added Sucessfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }