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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:41:22+00:00 2026-06-13T20:41:22+00:00

I have a partial view with a form in it that I place on

  • 0

I have a partial view with a form in it that I place on to my page using an @ajax.ActionLinK

  @Ajax.ActionLink("Update File", "CreateFileVersion", new AjaxOptions() { UpdateTargetId = "CreateFileVersion", InsertionMode = InsertionMode.Replace })

and here is my partial view

     @model CasWeb.Models.DataContext.FileVersion
    @{
        Layout = null;
    }
    <h4>Create File Version</h4>
    @using (Html.BeginForm())
    {
    @Html.ValidationSummary()

    <fieldset>
        <legend>File Version</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.VersionNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.VersionNumber)
            @Html.ValidationMessageFor(model => model.VersionNumber)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ActivationTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(m => m.ActivationTime)
            @Html.ValidationMessageFor(model => model.ActivationTime)
        </div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

This all works great, the user clicks on the link and the form appears with the “CreateFileVersion” div.

The problem comes with validation. When the user submits the form it goes to my controller which checks the data and returns the partial view back if it invalid. This partial view is no longer within the “CreateFileVersion” div, it now takes over the entire page.

How can I keep the partial view returned from my contoller within the “CreateFileVersion” div after validation.

Thanks

  • 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-13T20:41:23+00:00Added an answer on June 13, 2026 at 8:41 pm

    You should use an Ajax.BeginForm inside your partial instead of Html.BeginForm. This would allow you to submit the form using an AJAX call and specify the same update target id:

    @using (Ajax.BeginForm(new AjaxOptions { UpdateTargetId = "CreateFileVersion" }))
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On a view, i have a partial view rendering an ajax form that allows
Inside of an asp.net mvc partial view, I have an Ajax form that posts
I have a partial view that I'm using on my index page to display
if i have created a view model and have a partial form that is
I am using ASP.Net MVC. I have a partial view which has a form
I have a large Ruby on Rails form that has the following partial view
I have a partial view that I want to basically take care of itself
I have a partial view that is shared between two controllers and I'm trying
I have a partial view (UserControl) that implements a simple pager in my Asp.Net
I have a partial view which contain JavaScript and Ajax, but does not run

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.