joeharrison714 / MVCGrid.Net

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

Passing selected row columns value in JavaScript .Need help #65

Closed shefaliA closed 8 years ago

shefaliA commented 8 years ago

Hi, I have grid with a delete button in one of the column. I want to have a java script function which display Delete confirmation message to user .Upon confirmation I have to delete the row.

How I can get the value of column for a selected row in JavaScript help.

Can I use .WithValueTemplate on javascript side and if Yes how?

My Grid column defination --- cols.Add("Delete").WithHtmlEncoding(false) .WithSorting(false) .WithHeaderText("Delete") .WithValueExpression((p, c) => c.UrlHelper.Action("delete", "EmailTypeCode", new { id = p.CodeId })) .WithValueTemplate("");

-----------JavaScript function which I tried --------- $('#atcd-deleteEmailTypeCode').click (function () { console.log(document.getElementById("atcd-deleteEmailTypeCode").getAttribute("href")); var message = 'Are you sure want to delete EmailTypeCode with CodeID -' + document.getElementById("atcd-deleteEmailTypeCode").getAttribute("href"); return confirm(message); });

});