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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:22:56+00:00 2026-06-01T22:22:56+00:00

In an application being rewritten, originally a certain form included a drop down where

  • 0

In an application being rewritten, originally a certain form included a drop down where the user chose one of two major options for how the input would be used in calculations elsewhere.

The requirements now dictate that instead of this drop down, the interface should feature two otherwise identical forms appearing on the same page, one above the other. A parameter or hidden value is to determine whether the aforementioned option is set on each of the forms so that there is one form for each of the two options. This sets a boolean value on the model.

I’m using the same partial view for both appearances of the form, defining their differences during initialization. However, I’m still having one particular issue–if there is a validation error on one form, it appears on both. What’s the best way to prevent this?

Am I just going to have to give in and make near-duplicate partial views, or is there a way to keep using the same one?

  • 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-01T22:22:58+00:00Added an answer on June 1, 2026 at 10:22 pm

    You could try something like this:

    Create a base model for the form. That base model will have the properties and validation attributes that are common to its two child models:

    public class BaseModel {
        [Required]
        public string Name { get; set; }
    }
    public class Model1 : BaseModel {
        public bool Form1 { get; set; }
    }
    public class Model2 : BaseModel {
        public bool Form2 { get; set; }
    }
    

    You can then create two different controller actions that accept those models as parameters:

    public ActionResult PostForm1(Model1 model) { }
    public ActionResult PostForm2(Model2 model) { }
    

    And your partial view would have to add an input depending on which form it is:

    <form action="<%=(isForm1 ? "/PostForm1" : "/PostForm2")>%">
        <input type="hidden" 
               id="<%=(isForm1 ? "Form1" : "Form2")%>" 
               name="<%=(isForm1 ? "Form1" : "Form2")%>" 
               value="true" />
    </form>
    

    When a form gets posted, it should only do validation on its model and leave the other model untouched (you’d need a view model that has both form models as properties).

    I’m not sure if any of this would work, but, again, its something you could try.

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

Sidebar

Related Questions

I have a Java application which requires certain software (one of them being Perl)
My application is being penetration tested. One of the XSS items being flagged is
We have an application that is being moved to .NET. One part of the
I have a combo box in a C# Windows form application that is being
I have a smart client application being deployed with a CickOnce webpage. here's the
My application is being developed in silverlight. Plan to launch it later this year.
How do I prevent my device administration application from being installed? I have created
I have a Java Swing application that is being used as a cluster application.
I a web application that I am developing (being developed in PHP) when a
Our application uses Hibernate with Sql Server 2005. Being a DBA, I am not

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.