Installation of toolkit in MVC 3

Apr 5, 2011 at 1:14 PM
Edited Apr 5, 2011 at 1:17 PM

Hi community,

 Am new to ASP.NET MVC 3 i found out this link by Google search. i followed the installation procedure in this link  but i cant use the toolkit controls in my cshtml (i.e., file in View) what shall i do for this please any one come across with this issue can you help me

i did this changes in my project as follows 

 

 protected void Application_Start()
        {
            MVCControlsToolkit.Core.Extensions.Register();
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }

and in my Member.cshtml file i did this change where is need to use the toolkit contrls 

@model IEnumerable<CMSMainMVC.Models.MM_Account>
@{
    ViewBag.Title = "Member | Listing";
}
@using MVCControlsToolkit.Controller;
@using MVCControlsToolkit.Core;

Thanks,

ksnavinkumar@live.com 

Coordinator
Apr 6, 2011 at 2:46 PM

You need also to obviously add the Mvc Controls Toolkit dll to your references, and also jQuery, jQueryUi, and MvcControlsToolkit 0.9.js to your pages as required in the documentation of each component.

If you use Client Validation and Ajax you need also the respective js library as in any Mvc 3 project.  For globalization: the same you need to include also the globalization js as required in the globalization section.

However, please tell me what kind of problems are you experiencing?

What happens after you install the library?

You don't see the MvcControlsToolkit helpers when you are in the View?

In such case please just compile your project and you will see the MvcControlsToolkit helpers to appear.

Any exception is thrown?

In such case please provide the details.

Apr 6, 2011 at 3:00 PM

Hi frankabbruzzese,

thanks for you valuable reply first of all there is no error after installing toolkit 

the below code is the example taken from this post 

div id='@Html.PrefixedId("InnerContainer")'>
                            @Html.TypedTextBoxFor(m => m.Name, new Dictionary { { "class", "ToDoDetailName" } }, watermarkCss: "watermark")
                            @Html.ValidationMessageFor(m => m.Name, "*")

                            @Html.TypedTextBoxFor(m => m.WorkingDays, new Dictionary { { "class", "ToDoDetailDuration" } }, watermarkCss: "watermark")
                            @Html.ValidationMessageFor(m => m.WorkingDays, "*")

                            @Html.SortableListDeleteButton("Delete", ManipulationButtonStyle.Link)
                        

in the above code  they using @html.TypedTextBoxFor and @html.(some thing) i am not getting that dropdown help in my application after installing the toolkit what would be the problem.

I didn't made any additional changes more that in my first post but included the javascript file which is in the demo application provided along with this toolkit.

so should i do something more steps other than this. please explain me in detail

 

Thanks,

ksnavinkumar@live.com

Coordinator
Apr 6, 2011 at 4:38 PM
Edited Apr 6, 2011 at 4:41 PM

I see, the complete content of the file you are referring to should be :

 

@model Mvc_Examples.Models.SubTasksView

@using MVCControlsToolkit.Core;
@using MVCControlsToolkit.Controls;

<div id='@Html.PrefixedId("InnerContainer")'>
@Html.TypedTextBoxFor(m => m.Name, new Dictionary<string, object> { { "class", "ToDoDetailName" } }, watermarkCss: "watermark")
@Html.ValidationMessageFor(m => m.Name, "*")

@Html.TypedTextBoxFor(m => m.WorkingDays, new Dictionary<string, object> { { "class", "ToDoDetailDuration" } }, watermarkCss: "watermark")
@Html.ValidationMessageFor(m => m.WorkingDays, "*")

@Html.SortableListDeleteButton("Delete",  ManipulationButtonStyle.Link)
</div>

 

Now do the following:

1) take the original project downloaded from codeplex, open the file I have shown above whose nema should be:  SubTasksToSort.cshtml. Please verify that it works! On my computer it works and Visual studio give the suggestions.

2) Now if in your modified project you don't get the suggestions there are just the following possibilities:

  • You forgot to add the MvcControlsToolkit.dll to the references of your project;
  • You forgot: @using MVCControlsToolkit.Core; @using MVCControlsToolkit.Controls;
  • You made a syntactic error in the same page before the place you don't get the suggestion from Visual Studio, and as usual when you make errors Visual Studio stops doing suggestions.
    For instance in the code you posted you forgot the initial '<' of the div, you wrote div instead of <div
  • You need to compile correctly (that is without errors) at least once before Visual Studio starts seeing the helpers of the library, so be sure you have done at least one succesfull compilation after having added reference
    to the MvcControlsToolkit library 
  • Mvc 3 is not correctly installed. Please verify if the standard web site created when you open a new project in Visual Studio works normally.

Errors other than the one listed may cause exceptions either in javascript or .Net, but cannot prevent visual studio from suggesting helpers names

For instance if you forget some js file either some helper doesn't react properly in the page or you get a javascript exception...but this situation is very easy to identify so you can figure out easily

(with the help of documentation) which js you forgot.

Apr 7, 2011 at 5:05 AM

Hi frankabbruzzese,

Hope i have confused you because the code i have given above by me is not my code thats the code taken from the example project given in this post. But for me i was not getting the suggestion in my project. 

Even i included all the reference and namespaces in my project. Am using Razor engine not ASPX the example given in this post is all about ASPX.

Please give me support using the MVCControlsToolkit in RAZOR(cshtml) engine can you please provide me for that.

Sorry for confusing you.

Thanks

ksnavinkumar@live.com

Coordinator
Apr 8, 2011 at 9:03 AM

I sent you an email. Please answer back attaching a self-contained Visual Studio project that shows your problem

Apr 8, 2011 at 9:10 AM

ya sure and i have some more questions ill ask you in mail can i ask ????

Thanks,

ksnavinkumar@live.com

Coordinator
Apr 8, 2011 at 9:49 AM

Do whatever you want :)

Apr 8, 2011 at 12:48 PM
Edited Apr 8, 2011 at 1:03 PM

Hi,

i didnt receive any email from you please send me one more to the below address 

ksnavinkumar@live.com

 

and one more thing i have made some what i can by the use the example in this link. but even i have some more questions please reply me to my email.  and please explain me the project 

contained in folder name MVCCTRazorCompleteExample0.8 . can you :) Please

Thanks

NavI.S

Coordinator
Apr 9, 2011 at 9:45 AM

I sent another email, but if you don't receive it, please send me your project with the contact page of my Blog:  http://www.dotnet-programming.com/contact.aspx there you can attach files.

About the example you downloaded it is explained in my tutorials:
HOWEVER YOU DOWNLOADED THE 0.8 VERSION! HERE YOU CAN DOWNLOAD THE LAST VERSION: http://mvccontrolstoolkit.codeplex.com/releases/view/62910
Apr 11, 2011 at 6:42 AM

Hi,

it works for me now i referred with the example(DEMO) project provided by you  in this link( MVCCTRazorCompleteExample0.8 ) an i got the answer.

thanks for you timely help.. and one more help i need from you what are all the attributes that can declared for the class or class property 

like this 

 

[Required, CanSort, Display(Name = "Location ID")]
        public string LocationID { get; set; }

what i need is, The attribute CanSort was contained in MVCControlsToolkit so what are all the list of attribute that were contained in MVCControlsToolkit can you please give me the list of them.

so i can make use of that....

Thanks

ksnavinkumar@live.com

Coordinator
Apr 11, 2011 at 8:10 AM

The list is of all attributes is here: http://mvccontrolstoolkit.codeplex.com/wikipage?title=Data%20Annotations

Here you find the index of all documentation:  http://mvccontrolstoolkit.codeplex.com/documentation

Apr 11, 2011 at 10:25 AM

Hi,

How to use DropDownList in MVC 3 project i am using .edmx and a separate .cs file for both public partial class MM_Account and  public class MetaMM_Account. In my .edmx i have MM_Account as my Table name.

what my question is i have Location, Salutation and some more fields which requires Dropdownlist so how can i use SelectListItem class  to map with those fields and bind with the data accordingly. can you please provide my help.... :)

and can you understand what am i asking

Apr 11, 2011 at 10:25 AM

Hi,

How to use DropDownList in MVC 3 project i am using .edmx and a separate .cs file for both public partial class MM_Account and  public class MetaMM_Account. In my .edmx i have MM_Account as my Table name.

what my question is i have Location, Salutation and some more fields which requires Dropdownlist so how can i use SelectListItem class  to map with those fields and bind with the data accordingly. can you please provide my help.... :)

and can you understand what am i asking

Thanks,

ksnavinkumar@live.com

Coordinator
Apr 12, 2011 at 4:02 PM

Read the tutorial on the DropDowList here: http://codeclimber.net.nz/archive/2009/08/10/how-to-create-a-dropdownlist-with-asp.net-mvc.aspx

Read it to the end before starting to ...use it.

Anyway next mondady I will release the 1.0 version of the toolkit that contains an improved DropDownList helper that allows the separate styling of the various items

(this means you can give each item a different color, for instance) and the possibility to organize all items into groups. 

Apr 14, 2011 at 6:55 AM

Hi,

one more question. i found out some application loading difference between chrome and IE did you find any difference between browsers. for me IE loads faster than other browser can you have any article relating to this please post me back..

 

thanks

ksnavinkumar@live.com

Coordinator
Apr 15, 2011 at 8:40 AM

Yes there are differences of loading among browsers but there is not a fixed pattern. Some browser are paricularly slow on some operations. About IE, yes sometime it is faster,

however I detected it is very slow in operation involving the jQuery datepicker(at least one order of magnitude slower). Such difference change continuously as new updates of the browser are released

so, it is very difficult to consider them...I suggest that you concentrate just in browser compatibility, and in bandwidth consumption of your web pages. Loading take place on the client machine, and usually it is not the bottleneck.