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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:14:00+00:00 2026-06-07T07:14:00+00:00

This is My View: @foreach(var item in Model) { <tr id=TR@(item.Id)> @{Html.RenderPartial(_PhoneRow, item);} </tr>

  • 0

This is My View:

@foreach(var item in Model) {
 <tr id="TR@(item.Id)">
    @{Html.RenderPartial("_PhoneRow", item);}
 </tr>
}

_PhoneRow:

@model PhoneModel
@using(Ajax.BeginForm("EditPhone", new { id = Model.Id }, new AjaxOptions {
UpdateTargetId = "TR" + Model.Id
})) {
<td>@Html.DisplayFor(modelItem => Model.PhoneNumber)</td>
<td>@Html.DisplayFor(modelItem => Model.PhoneKind)</td>
<td><input type="submit" value="Edit" /></td>
}

Controller:

public ActionResult EditPhone(long Id) {
  //Get model by id
  return PartialView("_EditPhoneRow", model);
}

public ActionResult SavePhone(PhoneModel model) {
  //Save Phone, and Get Updatet model
  return PartialView("_PhoneRow", model);
}

_EditPhoneRow

    @model PhoneModel
@using(Ajax.BeginForm("SavePhone", new { id = Model.Id }, new AjaxOptions {
UpdateTargetId = "TR" + Model.Id
})) {
<td>@Html.EditorFor(modelItem => Model.PhoneNumber)</td>
<td>@Html.EditorFor(modelItem => Model.PhoneKind)</td>
<td><input type="submit" value="Save" /></td>
}

So When I click Edit Button the _EditPhoneRow Replaced Perfectly, but then when I click on Save button there is not any get, where is the problem?, why when updated the row with new partial view the new Ajax form not working? I think this issue is very popular, I just need Edit-Save With Ajax in any row, what is your suggestion? or any source or good sample for it?

  • 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-07T07:14:02+00:00Added an answer on June 7, 2026 at 7:14 am

    You have broken markup. It is forbidden to nest a <form> element directly beneath a <tr>. And when you have broken markup, you might get undefined result. In your case this undefined result translates by the fact that when you click on the submit button of the second form the submit event is not raised and nothing happens because the unobtrusive-ajax library lived/delegated for this event. The workaround consists into using another table.

    So:

    _PhoneRo.cshtml:

    @model PhoneModel
    <td>
        @using (Ajax.BeginForm("EditPhone", new { id = Model.Id }, new AjaxOptions { UpdateTargetId = "TR" + Model.Id }))
        {
            <table>
                <tr>
                    <td>@Html.DisplayFor(modelItem => modelItem.PhoneNumber)</td>
                    <td>@Html.DisplayFor(modelItem => modelItem.PhoneKind)</td>
                    <td><input type="submit" value="Edit" /></td>
                </tr>
            </table>
        }
    </td>
    

    _EditPhoneRow.cshtml:

    @model PhoneModel
    <td>
        @using (Ajax.BeginForm("SavePhone", new { id = Model.Id }, new AjaxOptions { UpdateTargetId = "TR" + Model.Id }))
        {
            <table>
                <tr>
                    <td>@Html.EditorFor(modelItem => modelItem.PhoneNumber)</td>
                    <td>@Html.EditorFor(modelItem => modelItem.PhoneKind)</td>
                    <td><input type="submit" value="Save" /></td>
                </tr>
            </table>
        }
    </td>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this view @model IEnumerable<ViewModelRound2> ... <snip> ... @{ using (Html.BeginForm(new { round1Ring3Bids
I have this piece of a HTML in a View: <% foreach (var item
This is My View: @foreach(var action in Model.Category.Actions) { <div class=action style=margin-right: 30px;> <input
I have a PaartialView declared like this: @model IEnumerable<mvc1.Models.ProjectDetailModel> @using (Html.BeginForm()) <form method=get action=EditProject
Consider following: Partial View: <%= Html.ListBox(BlackList, Model.Select( x => new SelectListItem { Text =
I have the following in my ASP.Net MVC 3 Razor View @foreach (var item
I'm getting this troublesome error in my view: The model item passed into the
I have just started using Html.RenderPartial(usercontrol, model) to render my user controls. Is it
I created a new View (LogView) in Infrastructure.Module project. This view will be used
How can i preselect item in Html.DromDownListFor() ? i have code in view which

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.