Toolbox

Updated grid controls, open-source comparison tools, and more

Scott Mitchell

Contents

Upgrade Your Windows Forms Grid
Add Professional-Looking Date Textboxes to Your Web Site
Quickly Compare and Merge Files
A Guide to Microsoft ASP.NET AJAX

Upgrade Your Windows Forms Grid

The grid is probably the most frequently used advanced user interface element as it is the easiest and most straightforward way to display and edit tabular data. Since the early days of Visual C++® and Visual Basic®, Microsoft has provided developers with a free, simple grid control. But developers can also take advantage of the grids that are available from third-party vendors.

One third-party vendor for Microsoft® .NET Framework Windows® Forms grid controls is FarPoint Technologies, Inc., which offers a grid component named Spread for Windows Forms 3. To add Spread for Windows Forms to your .NET application, simply drag an instance from the Visual Studio® Toolbox and drop it onto your form. Its initial data can be specified manually, programmatically, or via databinding.

Adding a Spread for Windows Forms grid to your application is like adding an instance of Microsoft Excel®. Like Excel, Spread for Windows Forms can include multiple sheets and formulas, have merged cells and cells that span columns, provide column-level sorting, and more. With one line of code you can import an Excel spreadsheet into a grid. Similarly, grid data can be exported to an Excel spreadsheet or XML file.

Customizing a Spread for Windows Forms grid in Visual Studio is particularly easy thanks to the Spread Designer. This standalone program, which can be launched from the Properties window in Visual Studio, enables developers to specify the appearance, layout, and format of their grids.

Grids are as routine a fixture in user interface design as buttons and labels. And some third-party grid products, such as Spread for Windows Forms, offer developers functionality beyond that provided by Microsoft.

Price: $899 per developer license.

www.fpoint.com

Spread for Windows Forms Grids Are Customizable

Spread for Windows Forms Grids Are Customizable  (Click the image for a larger view)

Add Professional-Looking Date Textboxes to Your Web Site

Large, commercial Web sites that prompt users for date values—such as travel reservation sites—often provide a textbox with a calendar icon next to it. Clicking this calendar icon displays the current month in a popup calendar and enables the user to select a date by simply clicking on it.

Such rich date entry user interfaces are found less often on intranet sites and on smaller Web sites, in part because ASP.NET does not include any built-in date-related Web controls. The good news is that there are many third-party date controls available. One such product is Peter's Date Package (version 2.0.4), created by Peter Blum, which comprises 24 ASP.NET Web controls. The flagship control is the DateTextBox, which displays a textbox with a calendar icon that, when clicked, shows a popup calendar interface. The calendar displays the current month with icons to display the dates from the previous or next months. The pop-up also includes a month and year picker, which expedites entering dates far in the future or past. Furthermore, the control automatically emits client-side script that prevents the user from typing non-date values into the textbox (such as letters or non-date related punctuation).

In addition to the DateTextBox control, Peter's Date Package includes a standalone month and year picker, an AnniversaryTextBox that lets users specify only a month and day, and a TimePicker control. There is also an array of date-specific validation controls. The UnselectableDatesValidator allows a developer to indicate a set of invalid dates, while the DateCompareValidator ensures that the dates entered into two date controls maintain a certain relationship, such as the first control's value being less than the second's.

Best of all, Peter's Date Package is a cinch to use. Configuring a new or existing Web site to use the date controls takes less than a minute, and including these rich date controls in a Web page is as simple as drag and drop. If you get stuck, Peter Blum is quick to answer questions posted to the support forums.

Price: $90 per Web server.

www.peterblum.com/DateControls

DateTextBox is the Flagship Control of Peter's Date Package

DateTextBox is the Flagship Control of Peter's Date Package  (Click the image for a larger view)

Quickly Compare and Merge Files

Since developers work with the source code for applications as a collection of files, we often need to compare different versions of files or folders and, perhaps, synchronize them. For example, you may need to determine what files have been modified since the last build, or update the production Web site's pages with the modifications made on the staging server. Programs that find differences in files have been around for decades—Windows has long included such a program, called WinDiff. Furthermore, virtually all source code control providers bundle some sort of WinDiff-like program to facilitate comparing different file versions under source control. But some developers want more capabilities than WinDiff and source code control programs offer.

WinMerge (version 2.6.8) is an open-source file and folder comparison and synchronization tool that is free, fast, and feature rich. When launched, WinMerge prompts you to select two files or folders to compare. You can also specify a file filter and line filter at this time. When including a set of files in a folder (or subfolders), the file filter indicates what files to include or exclude. For example, Web developers might want to use a filter that includes HTML and ASP.NET Web pages, but excludes GIF, JPG, CSS, and JavaScript files. You can create your own file filters or use one of the several that ships with WinMerge. Line filters can be used to exclude comparing lines of text that match a particular regular expression.

If you are comparing files from two different folders, WinMerge lists the files in each folder and whether or not they are identical. Clicking on one of the listed files displays a window showing the contents of the two files, using colors to indicate their differences.

WinMerge also makes it easy to synchronize files. You can step through the differences one at a time and choose whether to make the left file's difference the same as the right's, or vice versa. You can also make one file exactly like the other with the click of a button.

In addition to its intuitive graphical user interface, WinMerge can be executed from the command line and can be integrated with the Windows shell.

Price: Free.

www.winmerge.org

WinMerge Has an Intuitive Graphical Interface

WinMerge Has an Intuitive Graphical Interface  (Click the image for a larger view)

A Guide to Microsoft ASP.NET AJAX

AJAX is used by many to build interactive Web sites that offer a streamlined, desktop application-like user experience. AJAX-enabled sites use JavaScript to asynchronously communicate with the Web server and to seamlessly update the browser's interface accordingly. There are a variety of third-party and open-source AJAX frameworks, and now Microsoft has released its own AJAX framework, ASP.NET AJAX (ajax.asp.net).

Most AJAX-related books offer a rather exhaustive low-level look at the technologies involved. But that level of detail is unnecessary for a developer who wants to quickly get started building AJAX-enabled ASP.NET apps. These developers will find Matt Gibbs and Dan Wahlin's Professional ASP.NET 2.0 AJAX (Wrox Press, 2007) to be just what the doctor ordered. The book focuses on core AJAX concepts such as asynchronous postbacks, the browser's Document Object Model, and making HTTP requests via script—and each is explained in terms familiar to ASP.NET developers. Working with the Microsoft ASP.NET AJAX library is also explored, as is using the UpdatePanel control, the ASP.NET client library, ScriptManager, and the controls in the AJAX Toolkit.

Professional ASP.NET 2.0 AJAX also showcases tips and techniques for debugging. The techniques involved in building AJAX-enabled Web applications complicate the testing process. Since many AJAX-related functions occur in a Web browser, developers lose the rich debugging support available with server-side code. The chapter on testing examines ASP.NET AJAX's debugging-related classes and helpful tools such as Script Debugger from Microsoft, Eric Lawrence's Fiddler, and Nikhil Kothari's Web Development Helper. Additionally, the book explores the challenges involved in deploying any AJAX-enabled ASP.NET applications.

Price: $39.99.

www.wrox.com

Send your questions and comments for Scott to toolsmm@microsoft.com.

Scott Mitchell, author of numerous books and founder of 4GuysFromRolla.com, is an MVP who has been working with Microsoft Web technologies since 1998. Scott is an independent consultant, trainer, and writer. You can reach him at Mitchell@4guysfromrolla.com or via his blog at ScottOnWriting.NET.