2010's Most Popular Articles
By Scott Mitchell
Introduction
The end of the year is upon us, 2010 is about to be in the books. When closing out a year I like to take a look back at the articles I wrote over the year and see which ones resonated the most with readers. Which ones generated the most reader emails? Which ones were read the most? Such a retrospective analysis highlights what content was of most interest to developers in the trenches, and this data is used to guide article topics in the new year.
I ended last year with a "Best Of" article - see 2009's Most Popular Articles - and decided to continue this tradition. Such "Best Of" articles give both regular and new readers a chance to discover (or rediscover) the most favored content from the year. So here it is - a list and synopsis of the 2010's most popular articles on 4GuysFromRolla.com.
URL Routing in ASP.NET 4
Many websites these days use clean, terse, SEO-friendly URLs, such as
www.example.com/Categories/Beverages
, in place of URLs riddled with file extensions
and querystring parameters, like www.example.com/ShowCategory.aspx?CategoryID=BEV001
. ASP.NET Routing - a subsystem initially added to ASP.NET 3.5 SP1,
but enhanced in ASP.NET 4 - allows developers to define routing rules, which map a route pattern - such as Categories/CategoryName
- to a class of
ASP.NET page that handles the request.
For example, using ASP.NET Routing you can define a routing rule that maps all incoming URLs of the form Categories/CategoryName
to the ASP.NET page ShowCategory.aspx
. With such a rule in place, when a user visits a URL like www.example.com/Categories/Beverages
,
ASP.NET seamlessly (and behind the scenes) transfers control to your ASP.NET page, ShowCategory.aspx
. In ShowCategory.aspx
you can determine
the CategoryName value supplied in the URL and display information about that category. In short, ASP.NET Routing lets you decouple your website's public-facing
URLs from the actual code or ASP.NET page that is responsible for handling the request.
ASP.NET Routing is a cornerstone of ASP.NET MVC, but can also be used in ASP.NET Web Forms applications.
Read More >
Using Microsoft's Chart Controls In An ASP.NET Application

Using Microsoft's Chart Controls In An ASP.NET Application is a multi-part article series I started in July 2009 that looks adding charts to an ASP.NET application using the free Microsoft Chart Controls. Currently there are 11 installments, the last three added at various points during 2010:
- Getting Started - walks through getting started using the Chart Controls, from version requirements to downloading and installing the Chart Controls, to displaying a simple chart in an ASP.NET page.
- Plotting Chart Data - examines the multitude of ways by which data can be plotted on a chart, from databinding to manually adding the points one at a time.
- Rendering the Chart - the Chart Controls offer a variety of ways to render the chart data into an image. This article explores these options.
- Sorting and Filtering Chart Data - this article shows how to programmatically sort and filter the chart's data prior to display.
- Programmatically Generating Chart Images - learn how to programmatically create and alter the chart image file.
- Creating Drill Down Reports - see how to build drill down reports using the Chart control.
- Adding Statistical Formulas - learn how to add statistical formulas, such as mean, median, variance, and forecasts, to your charts.
- Enhancing Charts With Ajax - improve the user experience for dynamic and interactive charts using Ajax.
- Serializing Chart Data - see how to persist a chart's data and appearance to a persistent store.
- Using the Chart Controls with ASP.NET MVC - learn how to display charts in an ASP.NET MVC application.
- Exporting Charts - allow visitors to export charts as images and PDF files.
Read More >
Improving CSS with .LESS
Cascading Style Sheets, or CSS, is a syntax used to describe the look and feel of the elements in a web page. CSS allows a web developer to separate the document content - the HTML, text, and images - from the presentation of that content, which makes the markup in a page easier to read, understand, and update; it can result in reduced bandwidth as the style information can be specified in a separate file and cached by the browser; and makes site-wide changes easier to apply. Unfortunately, certain aspects of CSS's syntax leave a bit to be desired. Many style sheets include repeated styling information because CSS does not allow the use of variables. Such repetition makes the resulting style sheet lengthier and harder to read; it results in more rules that need to be changed when the website is redesigned to use a new primary color. Specifying inherited CSS rules, such as indicating that
a
elements (i.e., hyperlinks) in h1
elements should not be underlined, requires creating
a single selector name, like h1 a
. Ideally, CSS would allow for nested rules, enabling you to define the a
rules directly within the h1
rules.
.LESS is a free, open-source library that allows ASP.NET developers to create style sheets using new and improved language
features, including variables, operations, mixins, and nested rules. Behind the scenes, .LESS converts the enhanced CSS rules into standard CSS rules. This conversion
can happen automatically and on-demand through the use of an HTTP Handler, or done manually as part of the build process. Moreover, .LESS can be configured to
automatically minify the resulting CSS, saving bandwidth and making the end user's experience a snappier one.
Read More >
Accessing Server-Side Data From Client Script
When building a web application, the developer must decide how and when the browser will communicate with the web server. The ASP.NET WebForms model greatly simplifies web development by providing a straightforward mechanism for exchanging data between the browser and the server. With WebForms, each ASP.NET page's rendered output includes a
<form>
element that performs a postback to the same page whenever a Button control
within the form is clicked, or whenever the user modifies a control whose AutoPostBack
property is set to True. On postback, the server sends the entire
contents of the web page back to the browser, which then displays this new content. With WebForms we don't need to spend much time or effort thinking about how or when
the browser will communicate with the server or how that returned information will be processed by the browser. It just works.
While this approach certainly works and has its advantages, it's not without its drawbacks. The primary concern with postback forms is that they require a large amount of information to be exchanged between the browser and the server. Specifically, the browser sends back all of its form fields (including hidden ones, like view state, which may be quite large) and then the server sends back the entire contents of the web page. Granted, there are scenarios where this large quantity of data needs to be exchanged, but in many cases we can use techniques that exchange much less information. However, these techniques necessitate spending more time and effort thinking about how and when to have the browser communicate with the server and intelligently deciding on what information needs to be exchanged.
To address these challenges, I started a multi-part article series in October 2010 on different ways to access server-side data from the browser via client script. To date I've authored three installments in this series:
- Accessing JSON Data From an ASP.NET Page Using jQuery,
- Using Ajax Web Services, Script References, and jQuery, and
- Using WCF Services with jQuery and the ASP.NET Ajax Library
Read More >
Building a Store Locator ASP.NET Application Using Google Maps API

Like most store locators you'd find online, the application presented in this article prompts the user for an address (or city or ZIP code) and then displays a map and grid showing nearby store locations. Behind the scenes, the store locations and their latitude and longitude coordinates are stored in a database. When a user enters an address, the Google Maps API is used to translate that address into a latitude/longitude coordinate, which is then used in a database query to find stores within (roughly) a 15 mile area. The Google Maps API is used again to display a map of the address entered by the user along with pushpins showing the nearby store locations.
In August I wrote another two part article series that looked at implementing the store locator application in ASP.NET MVC - see
Implementing the Store Locator Application Using ASP.NET MVC for more details.
Read More >
Conclusion
There you have it, 2010's five most popular articles! If you missed any of the above articles, there are a couple of ways you can keep abreast of the latest 4Guys content. There's our weekly newsletter, WebWeekly, as well as our RSS feed.
Happy Programming and Happy New Year!