joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
74 stars 55 forks source link

Unable to add Confirmation message on Delete button on Grid #94

Open its-veejay opened 7 years ago

its-veejay commented 7 years ago

cols.Add("Delete").WithHtmlEncoding(false) .WithSorting(false) .WithHeaderText("Delete")
.WithValueExpression((p, c) => { if (p.isApproved == 3) { return String.Format("{2}","return confirm(\'Are you sure you wish to delete this story?\');", "/MvcPWy/Freelancer/Deleteb20EnglishStory/" + p.ID, "Delete");
} else { return ""; } });

codeweb commented 7 years ago

Hi, i added a class on button and then

$(document).on("click", ".btnDelete", function () {
            if (!confirm('Are you sure?')) {
                event.preventDefault();
            }
//delete
});

Note: i edited the code, so it's not tested.

joeharrison714 commented 7 years ago

Were you able to get it working?