Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Tom Bruce 114 posts 488 karma points
    Nov 30, 2018 @ 15:28
    Tom Bruce

    Hi everyone, I have an ActionLink to call a delete method within a controller

    @Html.ActionLink("Delete", "Delete", new { Id = d.ID })

    The problem is a ActionLink is an Get method and I can’t do a return CurrentUmbracoPage() form a Get method.

    The ActionLink is generated within a table to delete records.

    Any ideas how I can call a deleted method within a controller and then return the user back to the same page?


  • Nik 1044 posts 4220 karma points MVP c-trib
    Nov 30, 2018 @ 16:53

    Hi Tom,

    You could work around it by using a form and a post method.

    If you did something like

    <form action="@Url.ActionLink("Delete", "Delete") method="POST">
         <input type="hidden" value="@d.ID" name="Id" />
         <button type="submit">Delete</button>

    And then styled the form and button to look like a link.... that could work around it.

    Although to do it properly you'd want to use @using(Html.BeginUmbracoForm.... (Sorry don't have the full syntax for this at hand) to generate the form tags. As this would do the full Umbraco routing and I'm not sure the first option would.



  • Tom Bruce 114 posts 488 karma points
    Dec 02, 2018 @ 17:57
    Tom Bruce

    Hi Nik,

    Within the controller how would I get the value="@d.ID


Please Sign in or register to post replies

Write your reply to: