Beispiel #1
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "UpdateRec")
     {
         Response.Redirect("~/Admin/Update/frmUpdateCountry.aspx?CountryId=" + e.CommandArgument);
     }
     else if (e.CommandName == "DeleteRec")
     {
         country.CountryId = int.Parse(e.CommandArgument.ToString());
         country.DeleteCountry();
         lblMsg.Text          = "Record Deleted..";
         GridView1.DataSource = country.ShowCountry();
         GridView1.DataBind();
     }
 }
        public ActionResult Delete(FormCollection formcollection)
        {
            CountryBusinessLayer countryBusinessLayer = new CountryBusinessLayer();
            Country country = new Country();

            country.Id = Convert.ToInt64(Session["DeleteId"].ToString());

            int rv = countryBusinessLayer.DeleteCountry(country);

            if (rv != 0 && rv != -1)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }