Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Alert that the row was or not succesfully deleted
posted

Hi people, first of all sorry for my english.

My doubt is how i can inform to the user if a row of the grid was succesfully deleted from the database or if occured some error

My code is something like this

.cshtml

$('#grdFeeds').live('iggridupdatingrowdeleting', function (e, args) {
        return confirm("Sure to delete the row?");
    });

$('#grdFeeds').live('iggridupdatingrowdeleted', function (e, args) {
        $("#grdFeeds").igGrid("saveChanges");
        $("#grdFeeds").igGrid("dataBind");  
        }
    );

Controller.cs

public ActionResult EditingSaveChanges()
        {
            try
            {
                GridModel Model = new GridModel();
                List<Transaction<Feed>> transactions = Model.LoadTransactions<Feed>(HttpContext.Request.Form["ig_transactions"]);
                FeedNotificationEF oEF = new FeedNotificationEF();

                foreach (Transaction<Feed> oTran in transactions)
                {
                    switch (oTran.type)
                    {
                        case "deleterow":
                            int id = int.Parse(oTran.rowId);
                            Feed deleteFeed = oEF.Feeds.FirstOrDefault(FEE => FEE.ID == id);
                            if (deleteFeed != null)
                            {
                                oEF.Feeds.DeleteObject(deleteFeed);
                                oEF.SaveChanges();
                            }
                            break;
                        default:
                            break;
                    }

                }
                return View();
            }

            catch (Exception ex)            {
            }

 

Regards.

Pablo

Parents
No Data
Reply Children
No Data