Simple loading message to entertain user during background processes

There are a lot of ways this can be done, including using Ajax, Telerik controls or Update Panels, but with ASP.Net and Javascript, it can be very simple.  All you need is a server-side label, a simple css class and some simple jQuery.  First, your label with the loading text:

The css class is simple enough.  It just hides the label when we don’t want to see it.

Now, we can run some simple jQuery when the event occurs where we want to show the loading label (in this case,  a button click) to remove the css class from the element that is causing it to be hidden:

All we have to do now is hide the loading label by adding the appropriate css class after our work is finished on the server-side:

Easy, right?  I love easy!


Using C#’s new dynamic type

When developing an application for Leankit’s Kanban cards to sync with Microsoft Team Foundation Server work items, I found a use for the dynamic keyword in a practical situation.  The object that is returned from the API’s GetCard call is different from the Card object that exists when you make a call to GetBoardAttributes.  The fields that I require in my case, however exist on both objects, so I was able to create a function that can accept either as an input and work without skipping a beat.  Observe:

This function can be called using either CardReplyData or Card as the dynamic value and it will work.  Just be careful that both objects have the fields you think they do, as these can’t be checked until runtime because of the nature of dynamic.