Trying to render the page, and trigger a notification on button click. I have set this up to just do a pop up for now, since its an internal application for the higher ups.
The button in question is a simple razor syntax html helper with an onclick event to return a confirm dialog. However it seems I am unable to render the item variable for this.
@Html.ActionLink("Delete", "Delete", new { id = item.Id },
new { @class = "btn btn-warning",
onclick = "return confirm('WARNING: Delete @item.Id?');" })
this fails to render item.Id (the output of the surrounding foreach statement but instead outputs the string literal "@item.Id"
@Html.ActionLink("Delete", "Delete", new { id = item.Id },
new { @class = "btn btn-warning",
onclick = "return confirm('WARNING: Delete ' + item.Id + '?');" })
This renders the variable but since it is not a javascript variable it renders as "Delete undefined ?"
How can I use a variable from the foreach outside of the javascript passed into this dialog, to make the message more descriptive.