Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a database.

I added an edmx file using the connection string pointing to the already built database.

I created controller and view using scaffolding.

I want to modify the "Create" controller.

For that i added an "UserRegisterViewModel".

I tried to create a view out of "abcviewmodel" by right clicking on the action and selecting neccessary values in the "createview" dialog box.

But i got an error. "Unable to retrive metadata for... "

Here is my viewmodel

C#
public class UserRegisterViewModel
    {
        public int UserId { get; set; }

        [Required]
        [Display(Name = "User name")]
        public string Username { 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; }

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

        [Required]
        public string Email { get; set; }

        [Required]
        public string TeamName { get; set; }
    }

here is my action method in controller

SQL
public ActionResult Register()
        {
            return View();
        }


I built my project many times but failed to create view.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900