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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:57:29+00:00 2026-06-17T22:57:29+00:00

I have this method in the controller [HttpDelete] public void DeleteDocument(int id) { //Here

  • 0

I have this method in the controller

[HttpDelete]
public void DeleteDocument(int id)
{
   //Here I do the deletion in the db
}

In the view I have this, calling a method that returns a partial view

@{ Html.RenderAction("GetDocumentsByMember"); }

The GetDocumentsByMember method

    public ActionResult GetDocumentsByMember()
    {
        var companyGuid = HttpContextHelper.GetUserCompanyGuid();

        var documents = _service.GetUploadedDocumentsByMember(companyGuid);

        return PartialView(documents);
    }

And the partial view

@model IEnumerable<GradientCapital.DomainModel.Entity.Document.Document>
<div id="uploadeddocuments">
    @*Here there's a table and at one of the columns there's the next link*@

    <td id="delete">
        @Ajax.ActionLink("Delete", "DeleteDocument", new { id = document.Id },
        new AjaxOptions
            {
               Confirm = "Are you sure you want to delete?",
               HttpMethod = "DELETE",
               OnComplete = "deleteComplete"
            })
    </td>
</div>

And deleteComplete just refresh everything

<script type="text/javascript">
    function deleteComplete() {
        window.location.reload();
    }
</script>

Quite long (is correctly formatted?) code for a simple question, I can’t make the ajaxoption UpdateTargetId work here instead of having to call this deleteComplete function. Any idea?

Thanks

  • 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-17T22:57:31+00:00Added an answer on June 17, 2026 at 10:57 pm

    Instead of reloading the entire page you could call the GetDocumentsByMember action using AJAX and update only the portion of the DOM that has actually changed:

    <script type="text/javascript">
        function deleteComplete() {
            $.ajax({
                url: '@Url.Action("GetDocumentsByMember")',
                type: 'GET',
                cache: false,
                success: function(result) {
                    $('#uploadeddocuments').html(result);
                }
            });
        }
    </script>
    

    Also you’d better use OnSuccess = "deleteSuccess" instead of OnComplete = "deleteComplete" because you should update only if the Delete call actually succeeded. Don’t forget that the OnComplete callback is always invoked, no matter whether the AJAX call succeeded or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbee question here - I have this method in the view controller m: -(void)
I have this method in my mvc controller: public void RejectInvoice(int invoiceId) { var
I have this controller method: public JsonResult List(int number) { var list = new
I have this method in an external view controller APICallsViewController.m that I want to
I have a controller method in ASP.NET MVC that looks like this: public ActionResult
I have this controller method in my FilesController: public ActionResult Download(int id, string filename)
I have a controller method that is a little something like this: def suggestions
this must be a newbie question. I have this method in a controller: public
I have this controller method that needs to call many other methods (sometimes in
I'm using Asp.Net-Mvc, I have this method in my controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult LinkAccount(string

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.