I need a confirm window before calling the action specified in Url.Action
. My code is:
<a href="@Url.Action("Delete", "OriginalWorks", new {id = w.Id})"
onclick="return confirm('Do you... '+ @w.Title + '?')"><span></span></a>
Where w
is the instance of the OriginalWork class. If I look into HTML of the site, there is the right string value in confirm, but the window doesn't show and the action is called immediately. If a do the same with an int attribute, for example Id
:
<a href="@Url.Action("Delete", "OriginalWorks", new {id = w.Id})"
onclick="return confirm('Do you... '+ @w.Id + '?')"><span></span></a>
It works as expected, showing a message in an confirm window with an value of Id.
I tried Title.toString()
, but it doesn't help. I think it would work with Html.ActionLink
, but I want to use this because of span
in a a
element.
Any ideas? Thanks a lot.