Dynamically Load MVC Partials Using jQuery

Normally I do my examples in C#, but lately I have noticed a lack of VB.NET examples. Therefore, this example is in VB.NET.

I have searched long and hard to find a way to dynamically load MVC partials. I had tried to find a solution a few times, but quickly gave up. I figured there must be a way. Then I remembered how I used to create on the fly images using an HTML image control and simple URL to an ASPX page which served up the image ( another blog topic ). Through this latest realization and a little searching I have pieced together a working model. The piece I was missing was having the controller return a PartialView
. Continue reading Dynamically Load MVC Partials Using jQuery

Cookie Monster Would Be Disappointed

Using localStorage or sessionStorage would disappoint Cookie Monster.

My go to for a website to store data temporary was to use cookies. I would use cookies for storing user preferences, scores, shopping carts and more. Cookies can be a problem though as many people stop excepting cookies and they are difficult to manage. Continue reading Cookie Monster Would Be Disappointed

Simple MVC AJAX GET Method

MVC makes doing AJAX calls simple.  As I have said before, I do not like the AJAX controls and methods that the Microsoft ships with the MVC platform.  I prefer to create my own AJAX methods instead of posting a AJAX form.  I find I can get better control and I can create tighter rules around elements of importance.

The one thing I learned early is when doing a Get Method, you need to ensure that you give permission to the AJAX call to return JSON by adding the following to your JSON return object:

JsonRequestBehavior.AllowGet

This is an easy example of how to use your basic jQuery with your MVC Controller.

Continue reading Simple MVC AJAX GET Method

Using FitBit as a Software Developer

Confession: I am a Software Developer and I do not move much.

My wife had gotten a FitBit and was loyally using it. She offered to let me where it for a day which I did not do, but rather I told her that I am pretty certain I walk at least 10,000 steps a day easily ( FitBit suggested target ). She had purchased one for me and boy was it an eye opener; I was very immobile. In a given day I was lucky to get between 3,000 and 4,000 steps in a day and that is while walking two blocks to the car. Continue reading Using FitBit as a Software Developer

Joined the Dark Side and Loving It

A while back now I had a friendly debate with a colleague. It began innocently in a pub on a Friday night and it was Web Forms vrs MVC in the DotNet framework. I was anti-MVC for various reasons and in some sense I could still make an argument against MVC. We escalated our debate to a more public forum where we took the topic to the masses and presented our two sides. We created the exact same projects in our chosen DotNet platforms ( me in Web Forms and he was in MVC ) and we presented the projects. We talked about what we thought were the plus sides of what we chose and why. Before the debate I posted a question on LinkedIn for feedback and the feedback seemed positive for Web Forms. At the end of the debate, we asked our audience to make a choice based on their experience and what they had seen and Web Forms won.
Continue reading Joined the Dark Side and Loving It