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.
<<  Previous Article Continue reading and see our next or previous articles Next Article >>

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


jQuery Mobile ListView
In this article, we're going to look at what JQuery Mobile uses to represent lists, and how capable ...
JQuery Mobile Widgets Overview
An overview of widgets in jQuery Mobile.
Code First Approach using Entity Framework 4.1, Inversion of Control, Unity Framework, Repository and Unit of Work Patterns, and MVC3 Razor View
A detailed introduction about the code first approach using Entity Framework 4.1, Inversion of Contr...
jQuery Mobile Pages
Brian Mains explains how to create pages with the jQuery Mobile framework.
Exception Handling and .Net (A practical approach)
Error Handling has always been crucial for an application in a number of ways. It may affect the exe...

You might also be interested in the following related blog posts


WPF: Sliding Image Control Part 1 of Sliding Controls Collection read more
AJAX Extender Control: Interaction with List of Controls in Pop-up Window read more
Introducing RadScrollablePanel for Windows Forms read more
RadElement Lifecycle – a WinForms TPF Story read more
Designer v Xaml v Code read more
What's new in RadControls for Silverlight Q3.2009 read more
Data-binding Telerik CoverFlow for Silverlight + some Routed Commands goodness read more
November's Toolbox Column Now Online read more
Introducing Versatile DataSources read more
Visual Studio Extensions for RadControls for Silverlight Coming with Q3 2009 Release 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.

Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.