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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:07:55+00:00 2026-05-18T02:07:55+00:00

i have this problem that has been buggin me for the last hours. Lets

  • 0

i have this problem that has been buggin me for the last hours.

  1. Lets suppose i have this Signup form, that i need to fill it up, all propertieshave the RequiredAttribute, the model is a EF entity named “User”.

  2. i have this second edit account details form, and at this moment a specific field (“Username”) is no longer required, because i already have it, the user doesnt need to fil it again and in matter of fact it doest enven show up on the Edit form.

The problem:
when posting the second Edit form, obviously i am stucked with the Username RequiredAttribute.

I would solve this just by adding a “Bind” attribute with “Exclude” option, BUT, this is my current model :

public class AccountDetailsModel
{
    public User user { get; set; }
    public string NEWPASSWORD1 { get; set; } // new password
    public string NEWPASSWORD2 { get; set; } // new password comparison
}

and just looks like Bind Attribute with Exclude option doesnt handle complex Model types. I cant get it to work on this scenario.

Im stuck, scratching my heads for a long time now…

How can i overcome this?

I just want to re-use my EF Entity (User) on 2 different views along with its DataAnnotations.

Thanks in advance.

  • 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-18T02:07:55+00:00Added an answer on May 18, 2026 at 2:07 am

    I just want to re-use my EF Entity (User) on 2 different views along with its DataAnnotations.

    Here’s the problem. You shouldn’t do this. I would recommend you setting up view models which are classes specifically tailored for a given view and contain the necessary validation attributes for this view only. To ease the mapping between your EF models and the view models you could use AutoMapper.

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

Sidebar

Related Questions

No related questions found

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.