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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:27:11+00:00 2026-05-27T01:27:11+00:00

Got a pretty cool idea today but I’m not sure how to go about

  • 0

Got a pretty cool idea today but I’m not sure how to go about it.

I’m building a page by page form in asp.net MVC3 C#, that saves to a temporary area at the end of each page.

Now this data goes into a class with a few enumerable classes in it, so its relatively complicated.

Now, I want the user to be able to put in whatever the hell they want without validation (except security obviously), so that they can throw in whatever they want, however i want this to be soft validated.

I would like to use metadata for validation, however since this provides hard validation I can’t put this on the class that the form uses as a model (strongly typed). So, what i think is the best way to do it is to derive a class from the class on the form, and throw data annotations all over that (I’m hopeful that its possible to somehow apply an interface, but I’m assuming it isn’t)

THEN when the user wants to submit the form to our database, i want the form to go through and validate. I figure ill do this by converting the class without the data annotations that holds the data into the empty one with the dataAnnotations, and any errors that occur(essentially when the data isn’t valid) ill be able to list on the screen and tell them to fix it.

Now, another thing that i want to be able to do would be that i could somehow use the annotated class to soft validate the form when the user is on it. So i can say “we recommend you put this field in”. Rather than, “this field can’t be empty”.

So, in conclusion:

  1. Is it possible to turn interfaces on and off, if so, how?
  2. How would i convert classA into classB where classB is derived from classA and uses dataAnnotations
  3. (Continuation of 2) during the conversion, how would i catch any data errors and list them
  4. How could i soft validate off of classB on a form where the model is classA

I hope this is all possible. It seems like the cleanest way to do it. If anybody can think of a better way to do this, i am all ears… or eyes.


Update 1
Im under the impression that dataAnnotations would prevent me from putting any incorrect data in. However I’m doing some testing at the moment, and it seems I am able to apply incorrect data programatically. Ie null in a required field. So do data annotations only apply to validation on the page? If so, disregard my entire question.


Update 2
Im still looking for an answer if anybody can contribute

  • 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-27T01:27:12+00:00Added an answer on May 27, 2026 at 1:27 am

    I don’t think you can do this with the validation framework in MVC. Validation is a binary operation; input is either valid or it isn’t. The ValidationResult class used to indicate success or failure during the validation process doesn’t have a ‘Maybe’ member (to use a term), it’s either yes or not.

    That said, since you have control over the entire validation process, you can always define your own set of data annotation attributes and in your controller(s) test for what I assume would be ‘warnings’, and react accordingly, maybe by using a notification area that displays strings like ‘we recommend you enter data in this field” or something like that.

    This is assuming that you’re not using unobtrusive client-side validation, which I wouldn’t be sure how to circumvent. I’m talking about using the ModelState variable in your controllers in a way that you can go beyond the IsValid test.

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

Sidebar

Related Questions

Building an application which started as fairly simple, but now got pretty complicated. I
i've got a pretty simple .NET console application. I wish to pass in some
I do some PHP with Kohana 3 (IDE:Netbeans), and got excited about idea of
I'm trying NERDtree which is pretty cool, but what I'd like to do is
I really have little idea how ACL do work. I know it's pretty cool
I've got pretty interesting question about EcmaScript-5 Function.prototype.bind implementation. Usually when you use bind,
I've got a pretty basic question about how to start using Castle Windsor. I've
For practice, I'm trying to implement the merge sort algorithm but got stuck pretty
I got pretty experienced with testing controllers, my question here is though, aren't we
I'm working on an MFC application, that got pretty messy over years and over

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.