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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:13:03+00:00 2026-06-18T00:13:03+00:00

I am using below given class model (MVC 3 using C#) to register an

  • 0

I am using below given class model (MVC 3 using C#) to register an employee. Password/Confirm password fields are used at the time of new registration.
When I edit an existing employee, I don’t want to update/fill their password/confirm password again, but because of given validations (on password and confirm password) it doesn’t let me update rest of the information for employee.

 public class EmployeeModel
    {   
    ....
    ....
    [Required(ErrorMessage = "Password is must")]
    [Display(Name = "Password")]
    [MaxLength(20, ErrorMessage = "Password can be maximum 20 chars long")]
    [StringLength(20, ErrorMessage = "Password can be maximum 20 chars long")]
    [MinLength(5, ErrorMessage = "Not a valid password, must be atleast 5 chars long")]
    public string Password { get; set; }

    [Compare("Password", ErrorMessage = "Password and Confirm password do not match")]
    public string ConfirmPassword { get; set; }
    ....
    ....
    }

My questions are: Should I create another model class for editing an employee (This new model will not have password/confirm password field)? But I find it problematic because this kind of situation can arise with some other modules as well and I don’t want to end up having two model classes for each module.

OR Should I load the password/confirm password field while editing but hide them from user ?
Do above steps make sense? What other ways are possible ?

  • 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-18T00:13:04+00:00Added an answer on June 18, 2026 at 12:13 am

    there is concept of viewmodal. Create separate modal for every view to avoid such situation

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

Sidebar

Related Questions

I am trying to validate my model class using IDataErrorInfo as given below. //Validators
Can category model (example given below) be passed public class Category { public Guid
Am using below third party API in my project development http://undesigned.org.za/2007/10/22/amazon-s3-php-class I have done
I'm using below code to check some form fields and render datatable table on
Given the following view model and action using the DefaultModelBinder , it seems to
I have the following snippets in my MVC 3 website. Model: public class Item1
Given the code block below (source: http://www.asp.net/learn/mvc/tutorial-31-cs.aspx )... I receive this error: Using the
Using Rhino Mocks 3.6, given the code below I would expect the AssertWasCalled assertion
I am trying to create a user registration page using MVC 3, so that
I have a simple ViewModel as given below [Bind(Exclude = State)] public class CityViewModel

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.