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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:44:54+00:00 2026-05-25T00:44:54+00:00

For my first ASP.NET MVC 3 application I have a div on a partial

  • 0

For my first ASP.NET MVC 3 application I have a div on a partial view that displays a list of proposed names for a particular ice cream. I’m using, as my first crack at this, something like this to display the proposed names:

@model ViewModels.IceCream.{ProposedNamesViewModel
<table>
  <tr>
    <th></th>
    <th>Proposed Names</th>
  </tr>
  @foreach (var item in Model.ProposedNames)
  {
    <tr>
      <td>
         @Html.ActionLink("Delete", "Delete", new { id=item.Id })
      </td>
      <td>
         @item.ProposedName
      </td>
    </tr>
  }
</table>

and this works fine enough for displaying those names. These proposed names are but but one of a number of pieces of information about the selected ice cream and what I’d like to accomplish is to allow the user to add or delete a name and then have as a result of one of those actions have the updated viewmodel’s data re-displayed in that div (i.e., leaving everything else as it is on the page and just replacing that div’s contents with the new contents.

I can write the controller’s delete action just fine and it will update the underlying DB but then I’m not sure how to return this PartialView back to the particular div with my updated viewmodel. I hope that makes sense.

This (likely web developer 101) concept is one that I haven’t grokked yet and I’m hoping someone can show me how to do this.


Update

I’m looking at using jquery to solve this. Stephan Prodan (I believe that’s his name) has an example here where he updates a list of notes using jquery.

  • 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-25T00:44:55+00:00Added an answer on May 25, 2026 at 12:44 am

    JQuery is definitely a good direction to go with this. The only modification I would suggest to your table for a jQuery solution would be to add an index to each < tr > tag (unique for each row, preferably one based off the item displayed in the row). Then the rest is javascript. Bind a click event to the delete option, and on the delete, one jQuery line will do your job:

    $("#" + rowID).remove()
    

    As far as adding new rows, simply generate a string representing it:

    var newrow = "<tr id='newrowID'><td>Delete</td><td>proposedname</td></tr>
    

    And (now I realize you might want to add an id to your < table > as well if you have more than one on your page) then add it to the table with

    $("#" + tableID).append(newrow)
    

    or

    $('table').first().append(newrow)
    

    if it’s your first table on your page and you don’t want to give it an id.

    Lastly, you would need an AJAX call to get the information for the new item (or to send it to the backend if you create it on the page).

    EDIT:
    Suggested AJAX call:

    //disable input here
    $.ajax({
        url: "myurl/delete/" + idemID,
        success: function(response){
                           if(successful){ //determine this based on response
                                    $("#" + rowID).remove()
                                    //re-enable input
                            }
        error: function(err){ alert("Something went wrong"); /*re-enable input*/}
    })
    

    The disabling of the input prevents the user from providing multiple sucessive calls to the db that might conflict with each other or otherwise cause problems.

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

Sidebar

Related Questions

I have an ASP.NET MVC application that has a jQuery Treeview and a jQuery
I have developed a set of apis that live on an asp.net mvc application,
I'm working on my first ASP.NET MVC application and have a strange issue. All
I'm writing my first asp.net mvc application and I have a question about custom
I am about to use linqtosql in my first asp.net mvc application. I have
I'm building my first ASP.NET MVC application and I am having some troubles with
I am currently working on my first asp.net mvc application. I am trying to
I am building my first ASP.Net MVC based app and have a problem accessing
I have a new ASP.NET MVC project (my first), and I had been running
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have

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.