Articles : Page 5 of 6
- Filter:
- Fun
-
Calling ASP.NET MVC Action Methods from JavaScript
Aug 1119In a recent blog post, I wrote a a controller inspector to demonstrate Controller and Action Descriptors. In this blog post, I apply that knowledge to build something more useful. One pain point when you write Ajax heavy applications using ASP.NET MVC is managing the URLs that Routing generates on the server. These URLs aren’t accessible from code in a static JavaScript file. There are techniques to mitigate this: Generate the URLs in the view and pass them into the JavaScript API. This ...
-
Random Friday: Geek Verticals
Aug 1112Stumbling around the net, I ran into the “funny verticals” meme. These are typically a vertical strip of screenshots pulled from a movie or television with funny captions tacked on. If you do an image search for “funny verticals”, you’ll see a whole slew of them. Be forewarned, there are some very crude and offensive ones. For the lazy, here are a few representative ones I found to be funny. The first example is from the movie Inception: This is another one from Inception. There seems t...
-
The Backbone.js Todo List Sample, Refactored - Part 1
Aug 1111This is a long post with lots of code. I want to be complete, but I also don’t want to bore you to tears. If you want to see the refactor right now - here it is. I’m fairly certain I don’t know what I’m doing - and that I probably lack the experience to even be writing this post. All I can tell you is that I have a feeling… a not so good feeling… when reading the current Todo List tutorial up on Github. So I figured I’d refactor it and submit a pull request. Is this correct? You tell me… Wh...
-
The BackboneJS and Knockout Danceoff
Aug 1109I just rolled out Tekpub’s latest drop for the MVC 3 series: BackboneJS with MVC 3, and a lot of people are curious why I didn’t use Knockout. So here ya go - my thoughts on the two. http://www.pimpartworks.com/artwork/gmayhew/dance-off They Don’t Do The Same Thing It’s important to realize straight away that Knockout’s focus is different than Backbone. You can do the same things with Knockout that you can with Backbone - and vise-versa - but all they definitely are not two of the same f...
-
Text templating using Razor the easy way
Aug 1102As a web guy, I’ve slung more than my fair share of angle brackets over the tubes of the Internet. The Razor syntax quickly became my favorite way of generating those angle brackets soon after its release. But its usefulness is not limited to just the web. The ASP.NET team designed Razor to generate HTML markup without being tightly coupled to ASP.NET. This opens up the possibility to use Razor in many other contexts other than just a web application. For example, the help documentation fo...
-
How to access controller methods from a view in ASP.NET MVC
Jul 1130This question has been posed in several places. One of the places is on StackOverflow here. The use case here is that my controller has important state or an important function, and I’d like to leverage it from the view. It’s not appropriate to factor out to an html helper or other view-based utility class. It is something unique to the controller. It would be very easy to just pass the controller over to the view so that the view could make use of its methods, but there is a lot of discussion...
-
Entity Framework Code First Migrations: Alpha - NuGet Package of the Week #10
Jul 1128Hot on the heels of my RFC blog post on product versioning, the Entity Framework team has released Entity Framework 4.1 Code First Migrations: August 2011 CTP. Cool. And it's July, too! Or my preferred product name, Migrating Magic Unicorns 0.5. It's probably best to think of this as 0.5 Alpha Migrations for EF but that's my guess at a name and not nearly as descriptive. I showed early daily builds of EF Migrations at a few conferences recently, and encouraged folks to comment on the ADO...
-
CoffeeScript, Sass and LESS support for Visual Studio and ASP.NET with the Mindscape Web Workbench
Jul 1122There's some really impressive stuff happening in the .NET Community lately. Folks are reaching outside their standard built-in tools and pulling inspiration from everywhere. It's been said that (some) Microsoft developers don't like to use tools or technologies that aren't built in to Visual Studio. However, myself and others have been pushing the concept of LEGO blocks snapping together. Rather than thinking of Visual Studio as a giant single block, consider it as a small block amongst many...
-
Scott's Wonderful Twitter Favorites - Link Roundup 2
Jul 1121I realize that many (most) of you are not on Twitter. I am, however, on Twitter and I find it to be a joy. I have had a few complaints (just a few) because I tend to be random on Twitter. If you want only a stream of technical .NET resources, then don't follow me. However, if you want to follow the Whole Person, then please, join the fun. The most wonderful part of Twitter is just letting it flow over you. I tend to discover lots of interesting and cool stuff. So much so that I've started ...
-
Building MVC Select Lists The Easy Way
Jul 1118It is common to have a view model that contains a list of select list items ( IEnumerable ). However, I get a little annoyed when I see a select list item getting initialized like this: Widgets = db.Widgets.FindAll().Select(x => new SelectListItem() { Text = x.Name, Value = x.Value }); Although this is legal syntax its just a little bit too ugly for my liking. In an effort to make life simpler I came up with the following helper class: public static class SelectListFactory { public stati...

