Exemple #1
0
        public ActionResult Delete(Employ employ)
        {
            int    id     = Convert.ToInt32(employ.Empno);
            string status = EmployBLL.DeleteEmployBLL(id);

            if (status.Equals("Record not Found.."))
            {
                return(RedirectToAction("Index", "Employ"));
            }
            return(View());
        }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtEmpno.Text == string.Empty)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "m2", "alert('Please enter id to Delete')", true);
     }
     else
     {
         try
         {
             int    deleteId = Convert.ToInt32(txtEmpno.Text);
             string status   = EmployBLL.DeleteEmployBLL(deleteId);
             ScriptManager.RegisterStartupScript(this, this.GetType(), "m3", "alert('" + status + "')", true);
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "alert('" + ex.Message + "')", true);
         }
     }
 }