asp.net-mvcasp.net-mvc-2annotationsmetadataasp.net-mvc-futures

How do I install ASP.NET MVC 2 Futures?


I want to use the DataAnnotations.DisplayAttribute.Order property to arrange my fields when using the DisplayForModel and EditorForModel methods.

Related question:
Does the DataAnnotations.DisplayAttribute.Order property not work with ASP.NET MVC 2?

I think that I need to use the ASP.NET MVC 2 Futures. But I can't get it to work.

How do I install ASP.NET MVC 2 Futures?

Why are my fields still out of order?


Solution

    1. Download ASP.NET MVC 2 Futures from CodePlex.

    2. Save its files somewhere in the file system:

      C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 2 Futures\

    3. In the project, right-click References and choose Add Reference

    4. Browse to and then select file Microsoft.Web.Mvc.AspNet4.dll

    5. Register the model metadata provider in Global.asax.cs:

      protected void Application_Start()
      {
          ...
          ModelMetadataProviders.Current = new DataAnnotations4ModelMetadataProvider();
          DataAnnotations4ModelValidatorProvider.RegisterProvider();
      }