Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5960595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:50:52+00:00 2026-05-22T18:50:52+00:00

I have a @Ajax.ActionLink which calls a Delete Action. Now I want to use

  • 0

I have a @Ajax.ActionLink which calls a Delete Action. Now I want to use JQuery UI Dialog confirm instead the regular “Confirm” attribute of the Ajax link.
I hook the event to the Ajax.ActionLink using the unobtrusive javaScript. But the action gets submitted and the e.preventDefault(); throughs an error. Can anyone tell me why this happens?

Here is my jQuery code:

 $("[data-dialog-confirm]").click(function (e) {

        e.preventDefault();
        var theHREF = $(this).attr("href");
        $("#dialog-confirm").dialog('option', 'buttons', {
            "Delete this item": function () {
                window.location.href = theHREF;
                $(this).dialog("close");
            },
            "Cancel": function () {
                $(this).dialog("close");
            }
        });
        $("#dialog-confirm").dialog("open");
    });

Here is my MVC code:

    @Ajax.ActionLink("Delete", "DeleteConfirmed", new { id = item.Id },
                    new AjaxOptions
                    {
                        HttpMethod = "POST",
                        OnSuccess = "refreshList"
                    },
                    new {data_dialog_confirm="true" }
                    )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:50:53+00:00Added an answer on May 22, 2026 at 6:50 pm

    I ended up doing this:
    Change the Ajax.ActionLink to Html.ActionLink and in my JavaScript code I call $.get(theHREF, null, function () { refreshList() });

    Here is the code:

       $("#dialog-confirm").dialog({
            autoOpen: false,
            resizable: false,
            width: 500,
            modal: true,
            buttons: {
                "Delete this item": function () {
                    $(this).dialog("close");
                },
                Cancel: function () {
                    $(this).dialog("close");
                }
            }
        });
    
        $("[data-dialog-confirm]").click(function (e) {
            e.preventDefault();
            var theHREF = $(this).attr("href");
            $("#dialog-confirm").dialog('option', 'buttons', { "Yes":
            function () {
                $.get(theHREF, null, function () { refreshList() });
                $(this).dialog("close");
            }, "No":
          function () { $(this).dialog("close"); }
            });
            $("#dialog-confirm").dialog("open");
        });
    

    Here is the MVC 3 ActionLink

     @Html.ActionLink("Delete", "DeleteConfirmed", "Category", new { id = item.Id }, new
                        {
                            data_dialog_confirm = "true"
                        })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an @Ajax.ActionLink which for which I would like display a confirmation dialog
I have an Ajax.Actionlink for delete with confirm message, but the confirm message will
I have a web form and i want to call Asynchronously Ajax.ActionLink(). Please help
I have an ajax action link which is appending a partial to a div.
I have an ActionLink link this @Ajax.ActionLink(Delete it!, Delete, new {id = getTheID}, new
Trying to have a AJAX action link which when clicked, should do a HttpGet
i have an Ajax ActionLink which normally just returns a PartialView (which is just
I have a Ajax Action link, which will call a action Method, In my
I have a MVC page that loads a Partial via a Ajax.ActionLink, which works,
I have a view page with ajax.action link which returns a partial view from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.