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 8502235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:25:41+00:00 2026-06-11T01:25:41+00:00

I have been learning MVC 3 recently and I have found two solutions to

  • 0

I have been learning MVC 3 recently and I have found two solutions to deleting records from my list view. However I would like components of both of them, but my lack of knowledge in javascript is making this very difficult.

I have these two links for deleting:

@Html.ActionLink("Delete", "Delete", 
    new { id = item.ID }, new { @class = "delete-link" }) |
@Ajax.ActionLink("Delete Ajax", "Delete", "MyController",
    new {id = item.ID},
    new AjaxOptions {
        HttpMethod = "POST",
        OnBegin = "return ConfirmDone()",
        OnSuccess = "deleteConfirmation"
    })

The first one uses the following javascript to delete the record:

<script>
    $(function () {
        var deleteLinkObj;
        // delete Link
        $('.delete-link').click(function () {
            deleteLinkObj = $(this);  
            $('#delete-dialog').dialog('open');
            return false; 
        });

        //definition of the delete dialog.
        $('#delete-dialog').dialog({
            autoOpen: false, width: 400, resizable: false, modal: true, 
            buttons: {
                "Continue": function () {
                    $.post(deleteLinkObj[0].href, function (data) 
                    {  
                        var rowId = "#myTableItem-id-" + data.id;
                        $('.myTable').find(rowId).hide('slow');
                    });

                    $(this).dialog("close");
                },
                "Cancel": function () {
                    $(this).dialog("close");
                }
            }
        });
    });
</script>

The second link uses this script function for confirmation:

<script>
    function ConfirmDone() {
        return confirm("Are you sure you want delete this item?");
    }
</script>

Now both of these solutions work fine, however I prefer the coding of the second link, but I like the confirmation box that jquery-ui produces in the first link. So I would like to blend them together.

What I think I need to do is when the Ajax.ActionLink calles the ConfirmDone() then I need to show a jquery dialog as I do with the first link. However I am unsure how to produce this and allow this dialog to return a true or false depending on the button that is pressed.

Any help would be much appreciated.

Thanks very much.

  • 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-06-11T01:25:42+00:00Added an answer on June 11, 2026 at 1:25 am

    After a few hours of trying things out I have came up with a solution:

    My link changed to this:

    @Ajax.ActionLink("Delete", "Delete", "StruContractUser",
         new { id = item.UserID },
         new AjaxOptions {
             HttpMethod = "Delete",
             OnBegin = "JSONDeleteFile_OnBegin",
             OnComplete = "notify"
         },
    new { @class = "delete-link" })
    

    Which calls this function with the OnBegin option:

    <script type="text/javascript">
        function JSONDeleteFile_OnBegin(context) {
            return false; 
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been learning ASP.NET MVC recently and everything is going well apart from
I have been learning .MVC recently and am having trouble understanding how to process
I have been learning MVC recently and have started creating my own framework (for
I have been learning NodeJS recently. It seems to be standard in the Node
I have been learning ASP.NET MVC in the last few months and I think
I have been working on a little MVC project to assist in my self-learning
I have been learning ASP.NET MVC for a few months. I have learned about
I have been learning to develop websites using ASP.NET MVC 2 for work... and
I have been learning java spring hibernate MVC for 3 months and got pretty
I'm working on an ASP.Net MVC project and have been learning a few little

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.