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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:54:48+00:00 2026-06-08T16:54:48+00:00

I have a partial view that I’m using on my index page to display

  • 0

I have a partial view that I’m using on my index page to display a form. When an item is selected from a dropdown menu on the index page, the partial view is loaded with corresponding form data. I need to validate the form when submitted, but I’m not sure what to return from my controller that will load the page correctly when displaying errors. My submit button is currently on my partial view. (I tried moving the submit to the Index page, but it did not return anything from the form.) If there are validation errors, the partial view loads, but the dropdown menu from the Index view does not. I’ve seen a few solutions to this issue but none have worked in this situation, probably due to the dropdown. Any help is greatly appreciated. Please let me know if the HTML would be helpful, I was having issues formatting it for this post.

Controller:

public class PrinterSettingsController : Controller
{
    public ActionResult Index()
    {
        ViewBag.Areas = db.Areas.ToList();
        PopulateDocumentTypeViewBag();
        return View();
    }

    public ActionResult AreaDocumentSettingsList(int areaId = 0)
    {
        PopulateDocumentTypeViewBag();

        //get area, contains list of document settings
        }

        return PartialView("_AreaDocumentSettingsList", selectedArea);
    }

    [HttpPost]
    public ActionResult AreaDocumentSettingsList(Area selectedArea)
    {

        if (IsPrinterValid(selectedArea.PrinterName) == false)
        {
            ModelState.AddModelError(string.Empty, "Incorrect printer path entered.");
        }

        if (ModelState.IsValid)
        {

            //do some stuff, save the new records to the database

            db.Entry(originalAreaRecord).CurrentValues.SetValues(selectedArea);
            db.SaveChanges();

            //if everything saves fine, go to a different page
        return RedirectToAction("Index", "Workorder");

        }
        //if there are errors -- this part needs to be changed -- show errors in partial view, but also display view it's nested inside of

        return View("_AreaDocumentSettingsList", selectedArea);

    }
  • 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-08T16:54:50+00:00Added an answer on June 8, 2026 at 4:54 pm

    @cshemby’s link was helpful: Updating Partial Views with Unobtrusive AJAX in MVC 3

    But my problem ended up being that I was loading my partial view into a <div> tag with a javascript .changed event. In order to fix this, I added a @Html.RenderPartial to the Index page for the partial view and passed the value of the dropdown back to my controller instead. That way I could reload the entire page, including the validation.

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

Sidebar

Related Questions

I have a partial view that I am using from 2 different forms. In
I'm using MVC2 with VS2010 I have a view that has two partial views
if i have created a view model and have a partial form that is
I have a partial view that inherits from ViewUserControl<Guid?> - i.e. it's model is
I have a partial view that upon adding an item to the database needs
I have one (razor) page that contain 5 different partial views. Each partial view
Say I have a partial view that renders a dropdown list of Applications. When
I'm using .NET MVC3.... and I have a partial view that renders into a
I have a layout page within that layout I have used a partial view,
I have a partial view that I want to basically take care of itself

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.