Create Graphs, Send E-Mail, Spell-Check, and More

Scott Mitchell


Turn Boring Raw Data Into Stunning Graphs and Charts
Create, Parse, Send, and Receive E-Mail Messages from Code
Add Spell-Check to Your Web Forms
Build an ASP.NET E-Commerce App

Turn Boring Raw Data Into Stunning Graphs and Charts

As developers, we work with raw data on a daily basis, be it XML, the results from a SQL query, or information in a text file. However, most people are not as proficient with raw information. A well-designed and well-placed chart can greatly reduce the amount of time needed to understand the data in a report, especially when studying long-term trends or patterns.

The Microsoft® .NET Framework provides a variety of techniques that enable developers to programmatically create charts, but writing the code to turn raw data into eye-catching graphs is typically more hassle than it’s worth. I have learned firsthand that the cost and time to learn how to use a third-party charting control is far less than the struggles, challenges, and frustrations encountered when trying to create your own charts. One third-party charting control that I use is SharpGraph for .NET 1.2 by Data Dynamics. Like most charting controls, SharpGraph for .NET provides a bevy of chart types, including all of the common 2D and 3D types: area, bar, line, doughnut, pie, plot, and so forth. Moreover, the chart’s colors, legends, titles, and axes are highly customizable.

Create a Chart in Minutes with the SharpGraph Wizard

Create a Chart in Minutes with the SharpGraph Wizard(Click the image for a larger view)

What impressed me most about SharpGraph was its ease of use. Starting from an empty form, you can add a chart, bind it to data, and fine-tune its appearance all within a matter of minutes by using the control’s intuitive wizard. The wizard walks through the core chart settings, starting with the chart type, then the appearance, then the series data, and so on. The chart’s data can be manually entered, bound to a DataAdapter control or DataSet, or programmatically specified. There’s also a Chart Designer tool that simplifies customizing the chart’s appearance.

Moreover, these aesthetic settings can be saved to an XML file that can be loaded and used by other charts, either through the Chart Designer tool at design-time, or programmatically at run time. In addition to the wizard and Chart Designer, the chart’s data and appearance settings can also be set through the Properties window or with code.

SharpGraph for .NET also includes a number of bells and whistles. There are predefined color palettes, which are ideal for artistically-challenged developers like yours truly. It is also easy to specify transparency levels for the chart elements. And all SharpGraph charts can be programmatically exported to a variety of file formats, including BMP, GIF, JPG, PNG, and SVG, or to the Windows® clipboard as a BMP.

Price: $349 per developer license (includes royalty-free distribution).

Create, Parse, Send, and Receive E-Mail Messages from Code

E-mail messages are sent using the decades-old Simple Mail Transfer Protocol (SMTP). That is, the headers and body of the e-mail message are sent to an SMTP server using a standard protocol, which then ensures the e-mail message reaches its destination. Once an e-mail message reaches the intended recipient’s inbox, it is typically retrieved or viewed from an e-mail program like Microsoft Outlook® using either the Post Office Protocol (POP3) or Internet Message Access Protocol (IMAP) standards. The .NET Framework provides a simple and straightforward way to programmatically send e-mail to a specified SMTP server, but lacks classes for accessing e-mail messages from a POP3 or IMAP server. While the .NET Framework low-level networking classes can be used to communicate directly with a POP3 or IMAP server, such tasks are best left to a third-party component.

Enhanced E-Mail Functionality for .NET

Enhanced E-Mail Functionality for .NET(Click the image for a larger view)

One such component that offers functionality for both sending and downloading e-mail is Mail for .NET 2.1 from Dart Communications. Like the SMTP-related classes in the .NET Framework System.Net.Mail namespace, Mail for .NET can construct plain-text and HTML-formatted e-mail messages, include attachments, and send e-mail to the specified SMTP server synchronously or asynchronously. Mail for .NET sets itself apart from the .NET Framework classes with a number of additional features. For example, when sending an e-mail message asynchronously, a Progress event is periodically raised that reports the current progress.

The POP3- and IMAP-related classes make downloading or reading e-mail from a POP3 or IMAP server as easy as writing a few lines of code. As with the SMTP-related classes, e-mail can be accessed from POP3 and IMAP servers synchronously or asynchronously. The Progress and Trace events make it possible to track the progress as e-mail messages are downloaded or as data is sent or received. Furthermore, these events can be used to display a progress bar or for logging.

The Mail for .NET classes do not include support for communicating with SMTP, POP3, or IMAP servers over SSL. If you need to interface with secure mail servers, be sure to check out Dart Communication’s Secure Mail for .NET product.

Price: $499 per developer license (includes royalty-free distribution).

Add Spell-Check to Your Web Forms

While spell-checkers are a fundamental component of word processors, e-mail clients, and other desktop-based applications, they are rarely found within Web applications. For Web applications with short and simple data entry forms, users may be willing to overlook the lack of a spell-checker. But as the amount of text input grows, users will, naturally, want to ensure their entries are free of spelling mistakes.

Fortunately, adding an integrated spell-checker to your Web application is as easy as drag and drop with UltimateSpell 3.0 from Karamasoft. To add spell-checking to a Web page, simply drag the UltimateSpell custom ASP.NET server control from the Toolbox onto the Web page. The UltimateSpell control renders as a button that, when clicked, opens a new window that identifies and offers corrections for spelling errors in any single-line or multi-line textboxes or content-editable <div> tags on the page. In addition to the custom ASP.NET control, UltimateSpell includes client-side and server-side APIs.

Spell-Checking for Web Apps

Spell-Checking for Web Apps(Click the image for a larger view)

UltimateSpell’s spell-checker can be configured to bypass checking words that match specific patterns, such as words that contain all uppercase letters, words in mixed case, words with numbers, HTML tags, e-mail addresses, and so forth. These ignore options can be assigned to the control declaratively or programmatically, or specified by the end user as the spell-checker is running.

When spell-checking, UltimateSpell sends back bite-sized chunks of text to the Web server using AJAX; any spelling corrections are updated in the textboxes using client-side script. This functionality allows for a rich spell-checking experience without the need for a full postback, thereby providing a more responsive user experience. Moreover, UltimateSpell works in all major browsers, including Internet Explorer®, Netscape, Mozilla, and Opera.

UltimateSpell offers a bounty of bells and whistles, including spell-checking as you type, where misspelled words are underlined with a red squiggly as in Microsoft Word, and auto-correct, where misspelled words with only one suggested fix are automatically replaced with the suggestion. While these features are impressive, they do require an increased number of asynchronous callbacks to the Web server. In my testing, these frequent communications introduced quite a noticeable lag when users typed at a high word-per-minute rate.

Price: $299 for a developer’s license.

Build an ASP.NET E-Commerce App

Virtually all businesses today have a Web presence of some sort. Many small- to medium-sized businesses have a simple, mostly static Web site that provides little more than a description of the company’s products or services, contact information, and hours of operation. While such companies may want to upgrade their Web site to a full-featured e-commerce application, many hesitate because of limited developer resources to tackle major challenges like payment collection and processing, order fulfillment, and security.

Building a secure, fully-functional e-commerce Web application with ASP.NET, however, is easier than you may think and can be accomplished without hiring a team of expensive consultants. In Pro ASP.NET 2.0 E-Commerce in C# 2005 (Apress, 2006), author Paul Sarknas walks readers through the key steps of building an e-commerce ASP.NET Web application. Rather than focusing on just the e-commerce related tasks, Paul takes readers through the entire application building process. For example, there are high-level discussions on the application’s design and motivation, a look at creating the data model, techniques for building a tiered application architecture, deployment options, and so forth. This background, which encompasses nearly a third of the book, is especially helpful to intermediate ASP.NET developers who may not have had much exposure to building large and complex Web applications; expert ASP.NET developers can skim through these early chapters.

Once the foundation has been laid, the book turns to the e-commerce specific aspects of the Web application: creating the product catalog, implementing a shopping cart, and using the PayPal SDK for both payment processing and completing the checkout process. There are also chapters on order fulfillment, techniques for promoting the site, and ways to upsell customers.

While the book assumes a certain level of ASP.NET experience, Paul’s clear and concise writing style and his decision to build the e-commerce application from the ground up makes Pro ASP.NET 2.0 E-Commerce in C# 2005 an interesting, useful, and accessible read for both intermediate and expert ASP.NET developers alike.

Price: $59.99.

Send your questions and comments for Scott to

Scott Mitchell, author of numerous books and founder of, is an MVP who has been working with Microsoft Web technologies since 1998. Scott is an independent consultant, trainer, and writer. Reach him at or via his blog at ScottOnWriting.NET.

All prices were confirmed at press time and are subject to change. The opinions expressed in this column are solely those of the author and do not necessarily reflect the opinions of Microsoft.

MSDN Magazine does not make any representation or warranty, express or implied with respect to any code or other information herein. MSDN Magazine disclaims any liability whatsoever for any use of such code or other information.