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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:48:40+00:00 2026-06-12T03:48:40+00:00

So I have a partial view _Customer with a text box and a save

  • 0

So I have a partial view “_Customer “with a text box and a save button. Currently, the partial view code, I have this:

@model CompositeViews.Models.Customer

@using (Ajax.BeginForm("Edit", "Customer", new AjaxOptions { HttpMethod = "Post",     InsertionMode = InsertionMode.Replace, UpdateTargetId = "customerDiv" }))
{
<div id="customerDiv">
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Customer</legend>

        @Html.HiddenFor(model => model.CustomerId)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <p><input type="submit" value="Save" /></p>
    </fieldset>
</div>
}

the view lives withing a parent view called index (which also provides the model the partial view is dependent upon):

@model CompositeViews.ViewModels.CompositeViewModel
<h2>Index</h2>
@Html.Partial("_Customer", Model.Customer)

The parent view is named Index.cshtml and is fed by a simple controller action. When I click on the Save button in the partial view, it goes to the appropriate action on the appropriate controller, but I’m not too sure how to return the updated model data BACK into the partial view.

In all the examples out there, it’s a form that does an async post, but the UpdateTargetId targets a that is then filled with some type of updated content. That seems pretty straight-forward and simple.

What I’m struggling with is how to return the same form, with the updated model information using the existing view (_Customer). Basically, it’s a BeginForm which targets itself with the result from the controller action, not some other div that is not part of the form.

I’d like to NOT have to rebuild all the HTML by hand that the _Customer view does for me via the MVC framework and return that for rendering. I guess I’m stuck with the form in the partial view submitting the data to the controller, and then needing a way for that same view to re-draw itself on returning from the action method.

Any ideas?

  • 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-12T03:48:42+00:00Added an answer on June 12, 2026 at 3:48 am

    I hope I got you right and you want to show your updated on post back.
    In that case you can try this:

    <div id="customerDiv">
      @Html.RenderAction("Edit", "Customer", Model)
    </div>
    

    and put your @using (Ajax.BeginForm()) in Edit result.

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

Sidebar

Related Questions

I'm new to MVC Razor. I have this view: @model SuburbanCustPortal.Models.CustomerModel @{ ViewBag.Title =
I have a strongly typed View that accepts a Customer model, this customer model
I have this partial view rendered multiple times on a page: @model POS.Domain.Entities.Category <div
I have a Partial view (Login, with username, password and Submit button), and the
I have a partial view for displaying a list of items, I use this
I have a partial view that has a create button on it however it
I have a partial view that loops through its Model (a list of things)
I have partial view that displays model-specific flash messages. The partial looks like: app/views/mymodel/_flashpartial.erb
I have partial view which takes customer object and renders html. For customers list,
I have a partial view with some JQuery... $(#btnCancelPayment).click(function () { $(this).closest('#test').show('fast'); $(this).closest(#paymentSection).hide('fast'); });

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.