Installation With NuGet Packages
  1. Go to Tools -> Library Package Manager ->  Manage Nuget Packages... and select OnLine. Put either Mvc3ControlsToolkit or Mvc2ControlsToolkit in the search box. Once located the package press install.
  2. NuGet do all startup for you so you don't need to edit your global.asax
  3. Reference to the MvcControlsToolkit.Core, and MvcControlsToolkit.Controls namespace is already available in all your View, so you need to add just MvcControlsToolkit.Controls.Bindings to the pages that use some Client-Side ViewModel or Client-Side bindings features.
  4. Import the namespaces   MVCControslToolkit.Controls and MVCControslToolkit.Core, and MVCControlsToolkit.Controls.Bindings in your code as needed.
  5. Add reference to the JavaScript files used in your Views as required in the Documentation.
  6. If You need to modify the call to the MVCControlsToolkit.Core.Extensions.Register(), or the call MVCControlsToolkit.ActionFilters.PlaceJavascriptAttribute go to the App_Start folder created by NuGet end edit the MySuperPackage.cs file.

Pls. Notice Mvc Controls Toolkit supports jQuery from version 1.4.2 to 1.6.1. However, pls, use the last version of the jQuery.Validate library, to be sure it is compatible with the las versions of jQuery. 

Installation Without NuGet Packages
  1. Add reference to the MVCControlsToolkit dll into your project
  2. Say to MVC to use  MVCControlsToolkit default model binder and providers by adding the line of code below to your Global.asax file:

  3. protected void Application_Start()
            {
                MVCControlsToolkit.Core.Extensions.Register();
    GlobalFilters.Filters.Add(
    new MVCControlsToolkit.ActionFilters.PlaceJavascriptAttribute());
    //Above the lines of code to add AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); }
  4. Import the namespace MVCControslToolkit.Core and MVCControslToolkit.Controls in all .aspx Views  by addinging the following code in the Web.Config:

  5.     <pages>
          <namespaces>
            ............
            ............
            <add namespace="MVCControlsToolkit.Core" />
            <add namespace="MVCControlsToolkit.Controls" />
            <add namespace="MVCControlsToolkit.Controls.Validation" />
          </namespaces>
        </pages>
    
    

    and in all Razor Views by adding the following code in the Web.Config that is under the Views folder

  6. <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
          <namespaces>
            ............................
            ...........................
            <add namespace="MVCControlsToolkit.Core" />
            <add namespace="MVCControlsToolkit.Controls" />
            <add namespace="MVCControlsToolkit.Controls.Validation" />
          </namespaces>
        </pages>
    </system.web.webPages.razor>
     
    
  7. or just to each single View where you would like to use the Mvc Controls toolkit by inserting in each View the following import statements:
       
    @using MVCControlsToolkit.Core
    @using MVCControlsToolkit.Controls
    @using MVCControlsToolkit.Controls.Validation

    In all pages where you use Client-Side bindings you need to import also: MVCControlsToolkit.Controls.Bindings 
  8. Import the namespaces   MVCControslToolkit.Controls and MVCControslToolkit.Core, and MVCControlsToolkit.Controls.Bindings in your code as needed.
  9. Add the javascript files and the relative script references that might be needed by the controls you use in your pages.
  10. Enjoy!

Pls. Notice Mvc Controls Toolkit supports jQuery from version 1.4.2  However, pls, use the last version of the jQuery.Validate library, to be sure it is compatible with the last versions of jQuery. 

Last edited Jun 22, 2014 at 10:29 AM by frankabbruzzese, version 27

Comments

No comments yet.