Announcing the June 2012 Release of the Ajax Control Toolkit

I’m excited to announce the June 2012 release of the Ajax Control Toolkit. You can download the new release by visiting or (better) download the new release with NuGet: Install-Package AjaxControlToolkit The Ajax Control Toolkit continues to be super popular. The previous release (May 2012) had over 87,000 downloads from and over 16,000 […]

ASP.NET MVC Tip #50 – Create View Models

Recently, I noticed a nice pattern in the Nerd Dinner application. Nerd Dinner uses strongly typed view model classes to pass data from a controller to a view. This pattern provides you with a convenient way of representing complex view data. Note: If you haven’t downloaded the Nerd Dinner sample ASP.NET MVC application yet, you […]

ASP.NET MVC Tip #49 – Use the LinqBinaryModelBinder in your Edit Actions

I ran into a brick wall earlier today when I was attempting to create a controller with an Edit() action. I wanted to edit database records with LINQ to SQL. Here’s the controller action: Listing 1 – Edit() action [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(Product productToEdit) { try { _context.Products.Attach(productToEdit, true); _context.SubmitChanges(); return RedirectToAction(“Index”); } catch { […]

ASP.NET MVC Tip #48 – Disable Request Validation

By default, the ASP.NET MVC framework prevents you from submitting form data that contains potentially malicious content. This feature is called request validation. For example, submitting the following text in an HTML input field causes the ASP.NET MVC framework to throw an exception (Figure 1): <script>Alert(‘I am evil!’);</script> Figure 1 – An evil form post […]

ASP.NET MVC Tip #47 – Using ResolveUrl in an HTML Helper

Yesterday, I was creating a simple HTML helper for displaying images. Nothing fancy. The code for the helper is contained in Listing 1. Listing 1 – HelpersImageHelper.cs using System.Web.Mvc; using System.Web.Routing; namespace MvcApplication1.Helpers { public static class ImageHelper { public static string Image(this HtmlHelper helper, string id, string url, string alternateText) { return Image(helper, id, […]

ASP.NET MVC Tip #46 – Don’t use Delete Links because they create Security Holes

I created a sample ASP.NET MVC application that I plan to post at the website. While the application was being code reviewed by the ASP.NET MVC Feature team, a surprising objection surfaced. The application is extremely simple. It contains a view that renders a list of database records. Next to each record, there is […]

Essential Visual Studio Tips & Tricks that Every Developer Should Know

In this blog entry, I list the essential tips and tricks that every developer who uses Visual Studio 2008 should know. I wanted to keep this list brief. I also wanted to focus on only those tips and tricks that I use on a daily basis. Almost all of these tips and tricks are just […]

ASP.NET MVC Tip #45 – Use Client View Data

In this tip, I explore one approach to building Ajax applications with ASP.NET MVC. I show how you can use view data when building Ajax applications with ASP.NET MVC in the same way as you would use view data when building server-side application. I demonstrate how to create a custom HTML Helper that renders client […]

ASP.NET MVC Tip #44 – Create a Pager HTML Helper

In this tip, I demonstrate how you can create a custom HTML Helper that you can use to generate a user interface for paging through a set of database records. I build on the work of Troy Goode and Martijn Boland. I also demonstrate how you can build unit tests for HTML Helpers by faking […]

ASP.NET MVC Tip #42 – Use the Validation Application Block

In this tip, I demonstrate how you can use the Microsoft Enterprise Validation Application Block within an MVC application to perform both basic and advanced form validation. The Validation Application Block supports a rich set of validators that you can begin using in an ASP.NET MVC application. In this tip, I show how you can […]

If you liked this blog entry then please Subscribe to My Blog or Follow Me on Twitter