Published: 07 Sep 2007
By: Steve Orr
Download Sample Code

Direct some of Digg.com traffic your way with this free ASP.NET "Digg it" web control.

Introduction

Digg's throngs of readers are well known for swarming on hot news items until they ultimately bring down unprepared servers with their unbridled enthusiasm (or sometimes scorn.)  If you have a web site you're trying to promote, Digg.com could be quite valuable to you.  Digg is one of the few news and information sites on the Internet that has no editors.  Instead, all content is decided entirely by the Internet community.  Votes (aka Diggs) are tallied up automatically by Digg's servers, and the stories that the most people "digg" deservedly get the biggest headlines.

Get Dugg

There are a variety of ways people can submit and vote for useful content they've come across on the web.  If you want people to digg your site, then the most direct way is to put a "digg it" button right on it.  Then people can vote for your content right there; and then while they're reading it and when it's freshest on their minds.  I designed the free Digger control detailed in this article to be as easy as dropping a control on a web form.  It automatically takes care of all the details involved with linking up properly to Digg.com.  Go ahead and slap one on every page, you might be surprised which content people choose most.

Design Time Digging

In most cases, after adding the Digger.dll assembly to your Visual Studio toolbox, the Digger control can be simply dragged onto a web form with no configuration necessary.  By default the button will automatically submit a vote for the content on that page when clicked by a user.

In HTML view the declaration for Digger looks similar to this:

In the Visual Studio designer the control doesn't look like much more than a placeholder.  It also won't look like much when running on your private development workstation either.  But once it's placed on a public Internet server then Digg.com will be able to see the page and its Digger control, so it will spring to life.

Figure 1: The Digger control at runtime on a public Internet server.

diggit.jpg

Digger Properties

For situations when the default properties are just not good enough, you'll be glad to know that Digger is configurable in a variety of ways.  For example, the CustomUrl property can be used to specify that the vote should be cast for a URL that is different than the current page's URL.  This could be useful if you want to centralize your Digger voting buttons.  It can also be useful if you need to remove session IDs and other such garbage from the URL being submitted to Digg.

The BackColor property can be used to adjust some subtle shading around the edges of the Digger's interactive image output.

The Skin property can be changed from its default Normal enumeration value for situations where screen real estate is at a premium.  The Compact enumeration value shrinks the control into the image shown in Figure 2, while the Icon enumeration emits only a tiny 16 pixel square.

Figure 2: The Digger control can shrink to save screen real estate.

compact.jpg

The optional Title, BodyText, and Category properties are useful only the first time somebody diggs the content.  These items will appear as the default suggestions for the content description, although the person may alter it any way they see fit before submitting their vote. 

If the UseSiteMapForTitle property is set to True, then the control will attempt to retrieve its Title property value from the Title attribute of the current page's site map node at runtime.  If such a value is not available, the control will use whatever has been assigned directly to the Title property of Digger.  If no value has been entered there either, then Digger will industriously scrounge one up by filling it in from the Page's Title property.  The UseSiteMapForBodyText property works similarly when turned on, using the Description attribute of the current page's site map node to fill in the BodyText property automatically at runtime.

The optional Category property can be used to suggest a Digg.com topic area to be associated with this content.  There are about 50 preset categories (mandated by Digg.com) to choose from, ranging from Programming to Politics to Playstation 3 (and beyond).  The digger control enforces these categories so you don't have to worry about accidentally inputting an invalid entry.

Table 1: The Digger control has several useful properties to configure the runtime look and behavior.

Property Name Property Description
CustomUrl Can optionally be used when you wish a modified URL to be submitted to Digg instead of the current page's URL.
BackColor Can be used to adjust the subtle edge shading of the live public runtime appearance of Digger.
Skin Can be use to shrink the Digger control from its default Normal enumeration to Compact, or the even teensier Icon enumeration.
Title Can be used to suggest a title to the first person that diggs the content.
BodyText Can be used to suggest a content summary to the first person that diggs the content.
Category Can be used to suggest a Digg.com topic area to be associated with this content.
UseSiteMapForTitle When set to its non-default value of True, Digger will attempt to fill in its own Title property at runtime with the current page's title as specified in the site map (if any.)
UseSiteMapForBodyText When set to its non-default value of True, Digger will attempt to fill in its own BodyText property at runtime with the current page's description as specified in the site map (if any.)

Diggit

With this free Digger control you can now easily promote your web content, and - perhaps more importantly - allow others to easily promote it for you.  It certainly can't do any harm - unless a wave of interested Digg users accidentally take down your site!

References

  • Here is the download for the free ASP.NET Digger control described in this article.
  • If you're curious, you can find out about the HTML emitted by the Digger control here.
  • If you find this control useful, you may want to investigate many of the programming tools that Digg.com offers directly.  They've got a variety of widgets, tools and APIs that let programmers like us take advantage of their voluminous content in many interesting and creative ways.

About Steve Orr

Steve C. Orr is an ASP Insider, MCSD, Certified ScrumMaster, Microsoft MVP in ASP.NET, and author of the book “Beginning ASP.NET 2.0 AJAX” by Wrox press. He’s been developing software solutions for leading companies in the Seattle area for more than a decade. When he’s not busy designing software ...

This author has published 9 articles on DotNetSlackers. View other articles or the complete profile here.

Other articles in this category


JavaScript with ASP.NET 2.0 Pages - Part 1
ASP.NET 2.0 has made quite a few enhancements over ASP.NET 1.x in terms of handling common client-si...
ASP.NET ComboBox
The ASP.NET ComboBox is an attempt to try and enhance some of the features of the Normal ASP.NET Dro...
Upload multiple files using the HtmlInputFile control
In this article, Haissam Abdul Malak will explain how to upload multiple files using several file up...
JavaScript with ASP.NET 2.0 Pages - Part 2
ASP.NET provides a number of ways of working with client-side script. This article explores the usag...
Using WebParts in ASP.Net 2.0
This article describes various aspects of using webparts in asp.net 2.0.

You might also be interested in the following related blog posts


New article: How to detect and avoid memory and resources leaks in .NET applications read more
Sneak Peak: CSS Sprites Make Your Websites Faster read more
A new approach to build iGoogle/Facebook like sites with Asp.Net: Kalitte Widget Toolkit read more
Data-binding Telerik CoverFlow for Silverlight + some Routed Commands goodness read more
Important releases from Microsoft you may have missed read more
Designer v Xaml v Code read more
Choose your preferred data layout with RadListView for ASP.NET AJAX read more
ClientIDMode in ASP.NET 4.0 read more
Searching and Navigating Code in VS 2010 (VS 2010 and .NET 4.0 Series) read more
Gauges to join ComponentArt's expanding list of controls read more
Top
 
 
 

Discussion


Subject Author Date
placeholder Not really suitable for blog posts Simone Busoli 9/8/2007 3:33 AM
RE: Not really suitable for blog posts Granville Barnett 9/9/2007 5:56 PM
placeholder RE: RE: Not really suitable for blog posts Simone Busoli 9/9/2007 6:23 PM
RE: RE: RE: Not really suitable for blog posts Granville Barnett 9/11/2007 1:49 PM
placeholder Blogs have not taken over the world Steve Orr 9/11/2007 2:10 PM

Please login to rate or to leave a comment.

Product Spotlight