CobaltMVC is a way to use familiar jQuery style programming and CSS selectors in your ASP.NET MVC Views to populate content, change attributes and manage the full scope of the page.
Additionally, CobaltMVC is designed so it's easy to create Controls that perform a specific task, such as a Stylesheet or a Calendar, or for more specific purposes, such as binding a template directly to a Model.
What Does CobaltMVC Do?
CobaltMVC is able to select and modify content using the same jQuery style programming you're used to.
To take it a step further, CobaltMVC is context aware so you can write code at any scope in the page not worry that it changes more than it should.
How Does CobaltMVC Work?
No need to start a new project to use CobaltMVC in your web application. Simply add the bits to your project, perform a one time setup and you're ready to go!
CobaltMVC makes use of HtmlAgility Pack and ASP.NET Control Adapters to capture, process and output content to the client.
Does CobaltMVC Work With WebForms?
Yes! CobaltMVC is a great way to clean up some of the ugly WebForm markup with clean and consise html. At this time, the project has refences to both MVC and WebForms in the same code. For now projects will need to include references to System.Web.Mvc until the libraries can be separated.
How Does It Work?
CobaltMVC is designed to work very similary to jQuery by allowing you to use CSS selectors to find and modify elements in your view.
<%@ Control Language="C#" Inherits="ViewUserControl" %> <% //Wait for the page to become ready. this.Ready(() => { //Find elements with CSS Selectors this.Find(".twitter-feed h3") .Text("Twitter Feed For CobaltMVC") .AddClass("recently-updated"); //Access the Page scope from anywhere this.Page.Find("head") .Empty() .Prepend("<title>New Title</title>"); //Create and use custom controls Stylesheet style = new Stylesheet("/resource/style.css"); style.Media = "screen"; style.AppendToHead(); //Bind Models directly to a CobaltTemplate IEnumerable<Tweet> tweets = Tweet.GetRecentTweets(); this.Find(".twitter-feed") .Append(tweets); }); %>
CobaltMVC is able to select and modify content using the same jQuery style programming you're used to.
To take it a step further, CobaltMVC is context aware so you can write code at any scope in the page not worry that it changes more than it should.
125
Subscribers681
Followers136
Following57
favorites8
Repos16
Gists36
Followers8,444
Reputation10
Gold30
Silver48
Bronze