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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:18:30+00:00 2026-05-22T22:18:30+00:00

I have an MVC form for adding a simple entity. I am using TextBoxFor(model

  • 0

I have an MVC form for adding a simple entity. I am using TextBoxFor(model => model.FieldName) to create the input fields. I have a Save button and a Save and New button. The Save and New button is supposed to post back to the Save action and then return the current View with an empty model to enable the user to add another entity. However, what happens is that, even though the model is indeed empty, the input fields are being generated with the values entered for the previous entity. Hope this makes sense.

I know I could do a redirect, but that seems like an ugly workaround, so if anyone has run into this before, I’d really appreciate some input.

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-05-22T22:18:30+00:00Added an answer on May 22, 2026 at 10:18 pm

    The issue here is that your ViewData.ModelState is still populated with the values from the original post, even if the Model is null and you don’t explicitly pass any values into your view.

    I actually don’t think redirecting to the original action is that ugly of a solution, but if you don’t want to do that then clearing out the ViewData should work for you:

    [HttpPost]
    public ActionResult Save(TestModel model)
    {            
        ViewData = null;
        return View();
    }
    
    • 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 form for adding a module to a site. The
I have multiple MVC 3 forms that need form validation on certain fields (mostly
I have a form with many input fields on it, some with validation. I
ASP.Net MVC 3 using C# I currently have a form with some dropdown lists
I have an MVC view with a form built with the Ajax.BeginForm() helper method,
I have an ASP.NET MVC project with a form. In the Action method that
I have an MVC-based site, which is using a Repository/Service pattern for data access.
I have the whole MVC-Model set up and use HTML views as templates. But
I have an MVC 2 application that utilises forms. The required fields within the
I have an MVC application which has a set of fields for contact details

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.