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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:48:37+00:00 2026-05-12T09:48:37+00:00

I have a top-level page called ReceiveItem . Within that page, I have a

  • 0

I have a top-level page called ReceiveItem. Within that page, I have a couple different FORMs – only one of which will be filled out and submitted (depending upon how that item is received). This all works quite well from the UI perspective. Here is the general page structure:

<ReceiveItem.aspx>
    <ReceiveNewInventory.ascx>
    <ReceiveOrderReturn.ascx>
    <ReceiveFromLoan.ascx>

Except, I do not know how to properly display validation errors. Here is my controller for one of those forms:

    public ActionResult ReceiveNewInventory(
        int id,
        int vendorId,
        int quantity,
        decimal cost) {

        var db = new Data();
        var item = db.ItemSet.First(i => i.Id == id);
        var vendor = db.BusinessSet.First(i => i.Id == vendorId);

        ValidateCost(cost);
        ValidateQuantity(quantity);

        if (ModelState.IsValid) {
            item.AddNewInventory(vendor, quantity, cost);
            TempData["Message"] = "Added " + quantity + 
                " inventory items to " + item.FullDisplayName;
            return RedirectToAction("Index");
        }
        else {
            TempData["Quantity"] = quantity;
            TempData["VendorId"] = vendorId;
            TempData["Cost"] = cost;
            return RedirectToAction("ReceiveItem", new { id });
        }
    }

I would like to display the model errors that the two validation functions add using the simple Html.ValidationSummary function; but, those errors seem to get lost because I do the RedirectToAction. (My ReceiveNewInventory controller action does not have a view directly associated with it.)

With the one condition that I still want 1 page with multiple FORMs, what can I change about this design so that my validation messages show up on the ReceiveItem page?

  • 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-12T09:48:37+00:00Added an answer on May 12, 2026 at 9:48 am

    You need to put the ModelState into TempData and extract it in your ReceiveItem action method. Alternatively, change the Redirect to a return View()

    hth

    Dan

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

Sidebar

Related Questions

My application has several independent top-level windows, which all have completely different functions/workflows. I
On the page http://tesselaar.com/gallery/ I have a heading (level 1) at the top of
Currently, I'm trying to have a top-level window in Windows Forms with a custom
I have two QTreeWidgetItem that are top level. I want to make the second
Occasionaly we will have a page that required some page specific Javascript functionality. I
I have created a master page under my top level MOSS site. I have
I have two SqlDataSource controls on a page. One loads high level data and
I have a top-level _Layout.cshtml that looks something like this: <html> <head> @RenderSection(Header, required:
You can only have one form runat=server per page apparently. My page has one
I have 10 top-level domains e.g. example1.com, example2.com, example3.com, etc, and each domain has

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.