Month: December 2009

Useful snippets

I had two small “breakthroughs” while coding today that saved me quite a bit of time.  The first dealt with mocking HtmlHelper<T> with Moq for unit testing purposes: /// <summary> /// A mocked-out <see cref="HtmlHelper{TModel}"/> that can be used for testing. /// </summary> /// <typeparam name="TModel">The view model type.</typeparam> public class FakeHtmlHelper<TModel> : HtmlHelper<TModel> where…

Read MoreView 4 Comments

Exposing the View Model to JavaScript in ASP.NET MVC

The prevailing practice for moving data between the controller and the view in ASP.NET MVC applications is to utilize a view model.  While using a view model from within the view’s ASPX page is quite easy, utilizing it from JavaScript can be more complex.  While JavaScript blocks declared inline on the view page can easily…

Read MoreView 69 Comments

My best (or worst) MVC hack to date…

I really don’t know if I should be proud or embarrassed by what I just implemented.  I’m going to go with “embarrassed”.  If anyone sees a better way to do it, let me know. The Problem I have a multi-tab interface (via jQuery UI  tabs).  The view is strongly-typed and has a view model, so…

Read MoreView 5 Comments

A day in the life of a developer

I just got off the phone from a very frustrating conference call.  Today’s call brought to light something that I want to address.  It’s a misconception that many non-developers have about software developers.  I know this misconception exists because of the way I’ve heard people refer to our profession; because of the way non-developers in…

Read MoreView 24 Comments

Easy vertical and bottom tab panels with jQuery UI

jQuery UI includes a tabs widget that makes it easy to add tab panels to your web applications.  Out-of-the-box, it currently only supports horizontal tab strips across the top of the content, like so: There are samples in the jQuery UI code that show how you can easily achieve either side (vertical) tabs or bottom…

Read MoreView 6 Comments

Maintaining the expected type in fluent chains

There is a annoying bug in the code I posted for building FusionCharts from ASP.NET MVC.  If you use one of the fluent methods from the abstract builder class, you lose access to the fluent methods on the concrete.  Why is that?  Because the fluent methods on the base class all return the base type:…

Read MoreView 4 Comments

A fluent HtmlHelper extension for using FusionCharts in ASP.NET MVC, Part 2

Hey, it only took me nearly a month to write part 2 of this series!  Yeah, I’ve been neglecting this blog a lot lately.  There just aren’t enough hours in the day to write.  In part 1, I discussed charting with ASP.NET MVC and why I decided to use a Flash solution (FusionCharts Free) instead…

Read MoreView 20 Comments