Just Starting, MVC3 and jQuery UI
I am just starting on MVC and at the same time, jQuery. Probably not the smartest move, but since I believe I have the fundamentals of MVC3 I thought I would throw in some jQuery UI. Let me start by saying that it really isn’t all that hard, once you know what to change and where.
For this post I am just going to put what little I have done so far. I have been using Visual Studio 2010 in various flavors depending on where I am (Professional, Premium, and Ultimate). It should be enough to get most people started who may be in the same boat as I am. I am also not using a custom theme or anything, just the jQuery that comes with MVC3.
First thing I did was create my empty MVC3 project. I had read a post on Stefan’s Tech Notes that you should update your package references. This is simple enough. Right click on your project in solution explorer, in the menu that pops up click “Add Library Package Reference”. When it comes up you will see a list of installed packages and another menu on the left side. Click the word Updates on that left hand side. Now you will see a list of packages in the project that can be updated; I updated everything except EF. At work I had to keep going back to jQuery after I did each of the others, because it would not update that one until some reference was updated, which was in one of the others. At home I did not have this problem.
Now that my stuff is all up to date I added an empty controller which I called Home and added a View. I added the view by right clicking on my Index method in my controller and selecting Add View.
Now you have a view that you can use to play. To take advantage of the jQuery UI you need to set some references. I learned about most of these from a post on stevescodeingblog. The stuff we need to change is the css and js references at the top of Views/Shared/_Layout.cshtml. I’ll paste mine below.
And here is an image of what it created, the button is hidden behind the datepicker. To get the datepicker to popup I clicked inside my textbox. In my test it does not stay up there all the time.