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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:04:55+00:00 2026-06-12T09:04:55+00:00

I have an Index, a GET Create and POST Create action for my Person

  • 0

I have an Index, a GET Create and POST Create action for my Person model. I display the Index in a parent view so it is called as a ChildAction.

What I want to be able to do is also call the GET Create as a ChildAction into the same parent view or into the Index view. Then when the Create form is submitted, I want the Index to be refreshed.

How do I go about implementing this? I have been playing around with this using Ajax.BeginForm but it seems to be posting to the Create action multiple times so I think my attempt is flawed. My main problem is to get the Index action to refresh when the Create POST is successful. What should Create POST return?

All help and advice appreciated.

  • 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-12T09:04:56+00:00Added an answer on June 12, 2026 at 9:04 am

    Here’s how this could be set:

    public class HomeController : Controller
    {
        public ActionResult MainAction()
        {
            return View();
        }
    
        [ChildActionOnly]
        public ActionResult Index()
        {
            return PartialView();
        }
    
        [ChildActionOnly]
        public ActionResult Create()
        {
            return PartialView();
        }
    
        [HttpPost]
        public ActionResult ProcessCreate(SomeViewModel model)
        {
            return PartialView("Index");
        }
    }
    

    and the corresponding views:

    ~/Views/Home/MainAction.cshtml:

    <div>
        This is the main view
    </div>
    
    <div id="indexContainer">
        @{Html.RenderAction("Index");}
    </div>
    

    ~/Views/Home/Index.cshtml:

    <div>
        This is the index view @DateTime.Now.ToLongTimeString()
    </div>
    
    <div>
        @{Html.RenderAction("Create");}
    </div>
    

    ~/Views/Home/Create.cshtml:

    @using (Ajax.BeginForm("ProcessCreate", "Home", new AjaxOptions { UpdateTargetId = "indexContainer" }))
    {
        <button type="submit">OK</button>
    }
    

    Also don’t forget to include the jquery.unobtrusive-ajax.min.js script for the Ajax.* helpers to work:

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

    You will notice that I have renamed the Create POST action because otherwise when the Html.RenderAction helper is called after postback of the form it will execute the POST action once again and you will end up in an endless loop.

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

Sidebar

Related Questions

I have a listbox (detailed view). How do I get the index of the
In my routes I have: resources :accounts This produces: accounts GET /accounts(.:format) accounts#index POST
I have the following form: @model Teesa.Models.SearchModel @using (Html.BeginForm(Index, Search, FormMethod.Get, new { id
I have AspxTabPageControl.. of Devexpress I want to get the active tab index from
i have the following search form <?php echo $this->Form->create('Order', array('action' => 'search','type'=>'get'));?> <?php echo
In my cakephp app I have an Option model. In my option/index view I
I have the following model: public class Person { public int ID{get;set;} public string
In my rake routes I get: project_todos GET /project_todos(.:format) project_todos#index POST /project_todos(.:format) project_todos#create new_project_todo
Hello everybody, I have this problem (title of the post). Failure/Error: get :create, :user
I have a form that is suppose to be a POST to CREATE action

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.