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

  • Home
  • SEARCH
  • 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 7534843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:08:07+00:00 2026-05-30T06:08:07+00:00

I am currently trying to call a method from my view to change a

  • 0

I am currently trying to call a method from my view to change a boolean in my database, the only thing i don’t know since i am not really familiar with MVC is that whenever i call my controller method it gives me a blank page. I just want to call the method but stay in the actual view.

Here is the part of code in my view.

<td><a href="@Url.Action("PutInBin", "Capture", new { captureId = @Model.Files.Captures.ElementAt(i).Capture_Id })", onclick="DeleteCapture(@(i + 1))">Delete</a></td>

And here is the method in my controller

public void PutInBin(int captureId)
    {
        QueryCaptureToBin queryCaptureToBin = new QueryCaptureToBin();
        queryCaptureToBin.Capture_Id = captureId;
        client.PlaceCaptureInBin(queryCaptureToBin, userParams);
    }
  • 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-30T06:08:08+00:00Added an answer on May 30, 2026 at 6:08 am

    You could use AJAX:

    <td>
        @Ajax.ActionLink(
            "Delete",
            "PutInBin", 
            "Capture", 
            new { 
                captureId = Model.Files.Captures.ElementAt(i).Capture_Id 
            },
            new AjaxOptions {
                HttpMethod = "POST",
            }  
        )       
    </td>
    

    and don’t forget to include the jquery.unobtrusive-ajax.js script to your page:

    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
    

    and your controller action:

    [HttpPost]
    public ActionResult PutInBin(int captureId)
    {
        QueryCaptureToBin queryCaptureToBin = new QueryCaptureToBin();
        queryCaptureToBin.Capture_Id = captureId;
        client.PlaceCaptureInBin(queryCaptureToBin, userParams);
        return new EmptyResult();
    }
    

    and if you wanted to get notification when the delete finishes:

    <td>
        @Ajax.ActionLink(
            "Delete",
            "PutInBin", 
            "Capture", 
            new { 
                captureId = Model.Files.Captures.ElementAt(i).Capture_Id 
            },
            new AjaxOptions {
                HttpMethod = "POST",
                OnSuccess = "onDeleteSuccess"
            }
        )       
    </td>
    

    and then you would have your onDeleteSuccess javascript function:

    var onDeleteSuccess = function(result) {
        // normally the result variable will contain the response
        // from the server but in this case since we returned an EmptyResult
        // don't expect to find anything useful in it.
    
        alert('The capture was successfully deleted');
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to call a method from a utility class that will
I'm currently trying to register a JS function call from a .NET page which
I'm currently trying to write a Dump() method from LinqPad equivalent iin C# for
I am trying to create a partial view I call ImageViewer. It will be
I'm currently trying to consume a list of strings from some XML using Apache
I'm currently calling Trace (method below) from a game loop. Right now all I'm
I am new to Ruby and currently trying a few examples from the Ruby
Trying to call from an android client, using the signpost oauth libs. I generated
I'm trying to allow a user to call any method on a server using
I am currently trying to use a .net Task to run a long method.

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.