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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:49:08+00:00 2026-06-04T10:49:08+00:00

In MVC, I constructed a table in a view, by iterating over a ‘List’

  • 0

In MVC, I constructed a table in a view, by iterating over a ‘List’ of a viewmodel.

@foreach(var item in Model)
{
<tr id="row-@item.name">
    <td>
        @item.type
    </td>
    <td >
        @Html.ActionLink((string)item.name, "Download", "FileUpload", new { rout = item.rout, fileName = item.name }, null)
    </td>
    <td>
        @item.size
    </td>
    <td>
        <a href="#" id="delete-file" del-url="@item.delete_url">Delete</a>
    </td>
</tr>

}

when I load the page, I get a list of files, with a ‘delete’ link for each.

I implemented with jQuery a basic ‘remove row’ method:

$('#delete-file').click(function() {
    var delUrl = $(this).attr('del-url');
    $.post(delUrl, null, removeRow(),'json')
});

function removeRow() {
   $($('#delete-file').closest('tr')).fadeOut('slow');
}

When I click ‘delete’ on one of the file rows, it performs well, but then, if I click on another (delete), nothing happens. No file is deleted on server, and the row is not removed, as if it’s being ignored completely.

  • 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-04T10:49:09+00:00Added an answer on June 4, 2026 at 10:49 am

    You need to use class="delete-file" instead of id="delete-file" – and of course the corresponding $(".delete-file") selector as well.

    IDs are meant to be unique per document, and your code binds the handler to the first id="delete-file" element.

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

Sidebar

Related Questions

I am creating entity (of entity-view-controller)(in other words, model of MVC) classes which theoreticlly
MVC use action attributes to map the same view for http get or post:
MVC isn't generating the client-side validation rules for my viewmodel. The HTML just contains
i'm new in asp.net mvc 2. I'm trying to list all data from one
I have gone through the tutorial for component development at http://docs.joomla.org/Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.7_-_Part_06 . While the
I've been reading this paper: Enforcing Strict Model-View Separation in Template Engines (PDF). It
I really can't seem to get the hang of Model objects in MVC. I
When in the ASP.NET MVC 3 Controller lifecycle does the ControllerContext get constructed? I
Possible Duplicate: ASP.NET MVC: No parameterless constructor defined for this object I'm working on
I'm trying to dynamically construct URLs in an ASP.NET MVC website that point back

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.