You will probably agree that having 2+ monitors is one of the most productive enhancements you can do to your PC setup. It is not so easy when traveling or if you are embracing the post-PC era. This is why it is vital to have "multiple desktops" instead. This is not a new concept if you are coming from the Mac or Linux world. Why Windows still has not jumped on this is beyond me. Until this light hits them, let me introduce you to Dexpot.

First thing you will notice is a quick view in the taskbar. This ...

Cross-browser compatibility can be a major pain. The philosophy for most web developers is to code against a standard-complaint browser (Chrome), then apply CSS hacks later for other browsers that need to play catch up (Internet Explorer). In other words, it is better to make your code forward-compatible and apply backward-compatible hacks instead of the other way around.

One technique for cross-browser compatibility is using conditional comments in the HTML like this:

<!--[if IE]>
<style type="text/css">
  p { margin-left:20px;}
</style>
<![endif]-->


This works great, but it is very awkward and ...

To make your JavaScript more manageable, you should have a template engine of choice. I have been using Mustache.js for quite some time and love it. Instead of doing this:

var content = 'This is a ' + testA + ' test to ' + testB + ' put strings ' + testC;

You really should be doing this:

var template = 'This is a {{testA}} test to {{testB}} put strings {{testC}}';
var data = { testA: 'blog', testB: 'efficiently', testC: 'together' };
var content = Mustache.render(template, data);

Sure it looks like more lines of code, but throw ...
Last month, we announced the release of Falafel Tornado, a widget builder allowing you to create HTML5 / JavaScript widgets like image carousels and blog rotators on-the-fly without having to compile or deploy. Today, we are excited to unleash the Falafel Tornado Marketplace to allow you to download and share widgets from your Sitefinity backend!

The Falafel Tornado Marketplace comes as a slide-out from within the Content > Widget blocks area. No more trying to copy code from the community or cracking open your Visual Studio:



Do you have a great idea for a widget that you would like ...
When working with existing sites or content management systems, you have little say on where and when jQuery is loaded. To complicate matters, some pages may have jQuery auto-loaded, and others may not (yay for performance boosts, nay for client-side plugins). Do you bite the bullet and write unmanageable scripts? Or do you believe in RequireJS and dodge the bullet matrix-style? Let me show you how.

With RequireJS, you can asynchronously load JavaScript files when needed. For example, you can write a simple JavaScript module that depends on jQuery like this:

require([
   'jquery'
], function ($) {
   $('body').append(...
In a previous post, I showed how to create JavaScript widgets in Sitefinity using shared content blocks. This enabled you to create widgets like image carousels and blog rotators on-the-fly without having to compile or deploy. It was so useful in production and we received a lot of good feedback from the community. This is why we felt it deserved to evolve more and began creating a full-fledged Widget Builder for Sitefinity!

The idea is simple… when writing a web-based widget or control for a website, you need a mixture of HTML, CSS, and JavaScript. A portion sometimes goes ...
While developing web applications, it is common that you must test the site in SSL mode. Normally, this would be a pain and would require you to set up the site in IIS manually. From then on, you must attach the debugger in Visual Studio to the application pool process. There's an easier way!

IIS Express has been given a lot of attention with the Microsoft 2012 tools and it is certainly a better alternative to Cassini. And yes, IIS Express really is the full-fledged IIS except the config files are located in "C:\Users\%USERNAME%\Documents\IISExpress\config" rather than in the machine-wide location. ...
Navigation is one of the most important functions in any CMS. It is the doors you scatter throughout your site so your visitors can get around. It is no wonder there is an entire eco-system of menus... drop downs, horizontals, verticals, responsive design, tabs, panelbar, tree-view, content slide-outs, and the list keeps growing. This is one the most common requests for any web designer or developer. Just search the Sitefinity forums and you will see :)

The problem with using the Sitefinity navigation widget is that you have little control over the HTML that is rendered for the menu. ...
If you are like any other coder, cutting and pasting snippets should put up a red flag in your mind. You will quickly hit this threshold when creating CRUD-services for MVC 4 applications over and over again. This lead me to create a repository pattern using generic types and base controller classes that I would like to share with you. In the end, below is how my Web API classes look like, which automatically give me create, retrieve, update, and delete functionality:

using MvcWebApp.Helpers;
using MvcWebApp.Models.Data;
  
namespace MvcWebApp.Api
{
    public class SpeakersController : BaseApiController<Speaker>
    {
        //THIS ...
The web users of today expect a modern experience that only a single page application can deliver. Page refreshes are a thing of the past. Waiting for anything longer than 2 seconds without a "cool effect" is not acceptable. Responsive design for tablets and smartphones should just work.

These demands of the new era have spawned new ways to develop JavaScript applications. For modern, scalable, and extensible JavaScript applications, two techniques are on the forefront: MVC patterns and AMD design. For this demo, we will be using RequireJS for AMD modular design and CanJS for MVC.

By the way, I ...
Today I am going to introduce to you a new way of building Sitefinity widgets. A couple of them are actually live on our new home page. The image carousel and blog rotator are JavaScript widgets stored in shared content blocks. It's only a few lines of script and very elegant. See for yourself:

<div id="myCarousel" class="carousel slide hidden-phone"> <div class="carousel-inner"> <div class="loading-page"></div> </div> <!-- Carousel nav --> <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</...
Ever wanted to send request headers from jQuery instead of the "code-behind"? You can easily tweak the ajaxSetup object like this:

$.ajaxSetup({
    beforeSend: function(xhr) {
        xhr.setRequestHeader('X-Parse-Application-Id', 'QIDkel*****SR2c3');
        xhr.setRequestHeader('X-Parse-REST-API-Key', 'mbm311*****d0X2N');
    }
});
  
    console.log(data);
});



This is especially important when you need to be authenticated to use a service or API. Think of assigning server-signed auth tokens (that you generate on your own servers) to client-side apps. Now with every jQuery AJAX call, tokens get sent back to the server ...
What if I were to tell you that you can build modular client-side applications in Sitefinity and also not worry about JavaScript dependencies or conflicts? This should be music to your ears if you do any JavaScript development in Sitefinity.

First thing is you need to have solid understanding of what the Asynchronous Module Definition (AMD) is. Essentially, it is a standard for defining self-contained modules that loads dependencies asynchronously on demand. I suggest you take 10 minutes to read my blog post about this with examples. This will permanently change the way you think about JavaScript development. Once ...
So you have seen the light and ready to make the jump into ASP.NET MVC. But wait! You are not ready to migrate a million lines of code from your legacy Web Forms application? No problem. You can easily integrate MVC 4 into your existing Web Forms application and gradually phase out the legacy stuff over time.

There are many articles and blog posts about this topic. However, most are outdated or take the loooong way. I have a simple, clean solution for you! Here it goes:

  1. Upgrade your Web Forms application to .NET 4 (and Visual Studio 2012 if ...

In this post, I would like to open your eyes to a new way of developing JavaScript applications. We will be building modular JavaScript code on an MVC architecture while also handling dependencies. With these techniques, you can join a new era of web development and stop coding like it's 1999!

Prince - 1999

Asynchronous Module Definition (AMD)

First, let us get some terminology out the way. The Asynchronous Module Definition, or AMD, is a mechanism for defining modules such that the module and its dependencies can be asynchronously loaded. In other words, JavaScript files and units of code can be loaded via ...

Did you know in Razor markup you can do this:


<img src="~/Images/downarrow.gif" />
<a href="~/somehwere">Link</a>

And it will get auto-resolved on render, such as:


<img src="/MyApp/Images/downarrow.gif" />
<a href="/MyApp/somehwere">Link</a>

Another welcomed gem in MVC 4 :)
Update: To learn more, we're now offering an instructor-led Foundations of Sitefinity 5.1 class, where you'll learn how to use ASP.NET MVC + Razor, JavaScript and Kendo UI in Sitefinity 5.1. 

Sitefinity joins the MVC ranks with its 5.1 release and boy is it impressive. What makes it so unique is that Web Forms is still offered in the platform for developers to use as an alternative or hybrid approach. You heard that right, mix Web Form and MVC controls on the same page! Furthermore, with the MVC-only implementation, page templates are rendered as pure, unpolluted HTML pages. This is ...
Sitefinity leaves a lot to be desired with the REST services. For example, take a look at the returned data from Sitefinity's news service out-of-the-box:

{
   "Context":[
      {
         "Key":"String content",
         "Value":"String content"
      }
   ],
   "IsGeneric":true,
   "Items":[
      {
         "Author":"String content",
         "AvailableLanguages":[
            "String content"
         ],
         "CommentsCount":2147483647,
         "DateCreated":"/Date(928164000000-0400)/",
         "DateModified":"/Date(928164000000-0400)/",
         "DefaultPageId":"1627aea5-8e0a-4371-9022-9b504344e724",
         "ExpirationDate":"/Date(928164000000-0400)/",
         "Id":"1627aea5-8e0a-4371-9022-9b504344e724",
         "IsDeletable":...
Polling AJAX is tricky. If the next interval triggers before the last AJAX request is complete, your app is doomed!! This creates a domino effect where your queue for requests fill up faster then it can complete. Your queue will NEVER finish... similar to an infinite loop.

In light of this, you should never put AJAX into a setInterval function. A clean, more robust option is this:

(function poll() {
    setTimeout(function () {
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: 'http://somewhere.com/rest/123',
            success: function (data) {
                MyNamespace.myFunction(data); //DO ...
Update:  Find more of these tips and tricks in our Foundations of Sitefinity 5.1 class, where you'll learn how to use JavaScript, KendoUI and ASP.NET MVC + Razor in Telerik's Sitefinity CMS. Sign up for Foundations of Sitefinity 5.1.

 Creating a JavaScript application on top of ASP.NET MVC is becoming more common these days. Rightfully so, especially with the new Web API addition to MVC 4. The clear separation between client-side and server-side is an elegant architecture indeed!

Retrieving collections and objects from MVC is simply a matter of calling the REST URL via AJAX. The result will give you ...