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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:52:46+00:00 2026-06-02T00:52:46+00:00

I use the following model to control user input and to register him. But

  • 0

I use the following model to control user input and to register him.
But if I input the same passwords and press a button the message about that confirmation password is wrong appears.

I am sure about the model is correct because it works in some other page.
In this case RegisterModelSecond is a member of EventFrontEndViewModel.

So when I comment [Compare("RegisterModel.Password", ErrorMessage = "The password and confirmation password do not match.")] it works but no confirmation I need!

Any clue how to fix it?

public class EventFrontEndViewModel
    {
        public Page CurrentPage { set; get; }

        public List<Event> Events { set; get; }

        public List<Event> SubscribedEvents { set; get; }

        public RegisterModelSecond RegisterModel { set; get; }

        public EventFrontEndViewModel()
        {
            CurrentPage = new Page();
            Events = new List<Event>();
            RegisterModel = new RegisterModelSecond();
            SubscribedEvents = new List<Event>();
        }
    }

Register Model

public class RegisterModelSecond
    {
        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "Email address")]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }

and HTML

<div class="editor-label">
                                        @Html.LabelFor(m => m.RegisterModel.Password)
                                    </div>
                                    <div class="editor-field">
                                        @Html.PasswordFor(m => m.RegisterModel.Password)
                                        @Html.ValidationMessageFor(m => m.RegisterModel.Password)
                                    </div>
                                    <div class="clear">
                                    </div>
                                    <div class="editor-label">
                                        @Html.LabelFor(m => m.RegisterModel.ConfirmPassword)
                                    </div>
                                    <div class="editor-field">
                                        @Html.PasswordFor(m => m.RegisterModel.ConfirmPassword)
                                        @Html.ValidationMessageFor(m => m.RegisterModel.ConfirmPassword)
                                    </div>
                                    <div class="clear">
                                    </div>
  • 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-02T00:52:48+00:00Added an answer on June 2, 2026 at 12:52 am

    I found correct answer here MVC 3 Client-Side Compare Validation

    This is a bug in the client side validation script: jquery.validate.unobtrusive.js

    At Line ~284 you’ll find this:

    element = $(options.form).find(":input[name=" + fullOtherName + "]")[0];
    

    Change it to this:

    element = $(options.form).find(":input[name='" + fullOtherName + "']")[0];
    

    The name attribute needs single quotes.


    I want to add if you use MIN version u have to change it there as well.

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

Sidebar

Related Questions

I have the following code in my user control: <asp:LinqDataSource ID=myLinqDataSource runat=server AutoSort=true ContextTypeName=MyDBContext
i need to model the following scenario, but I can't get it working with
I Have a Strongly typed user control which i use for Searching a certain
I've got an MVC user control with the following basic structure: <%@ Control Language=C#
I am trying to use JQuery UI dialog (modal form) for the following scenario.
I use following code: Create a retry policy, when error, retry after 1 second,
for example i use following command to find a record SELECT `users`.`mail` FROM `users`
I would like to use following sql to avoid constructing sql dynamically: SELECT CommentID,
I use VS2010, C# to develop Silverlight 4 app, I use following code in
Hello Sir i want send list of data to php server i use following

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.