In a recent blog post I shared a preview of the Cobalt project I've been working on. Today, the source code has been uploaded to git-hub and the first beta binaries are being released!

If you've seen any of my previous blog posts then you realize I'm not much of a fan of the current way to populate templates in ASP.NET MVC. I've tried a handful of different ways to improve the experience but so far nothing really felt like an improvement.

You can see that much like jQuery we have to queue up the work we need to execute once the document is ready.

I have a lot of documentation to write and a lot of screencasts to record, but for now, here are a list of the more important details.

The Important Stuff!

You must call CobaltManagement.Initialize() in your Global.asax file in the Init method (just override it and call it).

Cobalt uses HtmlAgilityPack to handle parsing of html content. I'm not happy with the framework so it will be one of the first things to be phased out, but for now you need to make sure to download it if you get the source code instead of the binaries.

You must use this.Ready from your pages and controls to wrap your commands. Otherwise your commands will run before the document is ready and fail.

Cobalt is aware of context, so if you use this.Find within a UserControl then you're only going to select elements within that control. If you need to access the Page level from a UserControl then you can call this.Page.Find to change the scope of the command.

Cobalt supports a decent amount of selectors. Below is a list of currently available options.